ljharb / prop-types-tools

Custom React PropType validators
MIT License
671 stars 50 forks source link

[New] add explicit react 17 support #74

Open ljharb opened 3 years ago

ljharb commented 3 years ago

Fixes #73.

ljharb commented 3 years ago

This is blocked on https://github.com/enzymejs/enzyme/pull/2430

max-pv commented 3 years ago

@ljharb Thanks for adding this. I think it would be great if the peer dependency also supported ^16.0.0 instead of ^16.0.0-alpha.

ljharb commented 3 years ago

@br4in3x why? That’s strictly fewer versions.

tdd commented 3 years ago

Hey @br4in3x and team, can we please get progress on this? Lack of React 17 peer dep definition has forced us to use --force / --legacy-peer-deps every npm install since last Fall. That seems like a tiny change to make. I can assure you the module works fine with React 17.

ljharb commented 3 years ago

@tdd glad to hear it; we’re still waiting on https://github.com/airbnb/prop-types/pull/74#issuecomment-716833323 so that we don’t need to rely on such assurances.

jasco commented 3 years ago

While continuing to wait for an official Enzyme Adapter to support React 17, it appears https://github.com/wojtekmaj/enzyme-adapter-react-17 might be an option.

ljharb commented 3 years ago

@jasco we won't ever use an unofficial adapter.

marksmccann commented 2 years ago

Looks like this PR has been sitting for some time. Is there any intention to add React 17 support? If so, can we get an ETA?

ljharb commented 2 years ago

@marksmccann yes, the intention is eternal. There is no ETA, because enzyme’s react 17 support has no ETA. Once that lands, this can.

marksmccann commented 2 years ago

@ljharb Thanks for the quick reply. Looks like you've been waiting over a year and a half for enzyme to add support React 17. Looks like they also have attempted to update, but stalled out. And now that React 18 is out, you're getting further behind. Is there a point at which you throw in the towel and start searching for an alternative solution? Granted, I wouldn't want to do the migration, I'm just curious.

ljharb commented 2 years ago

If an actual full alternative to enzyme were to appear (none currently exist) then I'd probably deprecate enzyme in favor of it, and switch this package to use it. However, there doesn't seem to be any interest in the community to fill that need, nor from the react team, so I remain convinced that the best path is still for enzyme to add support, and for these packages to continue to use it for testing.

Im-Fran commented 1 year ago

If an actual full alternative to enzyme were to appear (none currently exist) then I'd probably deprecate enzyme in favor of it, and switch this package to use it. However, there doesn't seem to be any interest in the community to fill that need, nor from the react team, so I remain convinced that the best path is still for enzyme to add support, and for these packages to continue to use it for testing.

I found this library that has support for react 18: https://testing-library.com/docs/react-testing-library/migrate-from-enzyme maybe it'll help. That library also includes a migration from enzyme that could make the transition easier.

ljharb commented 1 year ago

@Im-Fran no, unfortunately that package/ecosystem doesn't come remotely close to replicating enzyme's capabilities.

Im-Fran commented 1 year ago

Is this what you're talking about? image

Anyway, you know more than me about this repo :laughing: so you're the one to choose. Have you found any other alternative? because maybe it would be time to fork enzyme and update it by yourself

Im-Fran commented 1 year ago

Mainly to support new versions, because I'm personally using the react outside click handler and it's holding me back. Even if it works in react 18 I would prefer for it to be officially supported.

ljharb commented 1 year ago

I maintain enzyme, so there's no need to fork it - I just need the time, the help, or the money (such that I can create the time or hire the help) to update it, and it's been 5 years without anyone providing sufficient amounts of any of those.

Im-Fran commented 1 year ago

I know this question shouldn't be in this issue (because it is from another repo), but why not merging https://github.com/enzymejs/enzyme/pull/2430? It's been there since 2020. I know that you need to make sure it works and everything, then post the release, but it would be a step forward merging some PRs, also it seems that one was already discussed by you and other people.

Im-Fran commented 1 year ago

Also I wanted to thank you for your hard work <3 it's really good what you're doing with all these libraries :p

Im-Fran commented 1 year ago

ok, just finished reading all the comments, and I saw that react had added some stuff that broke compatibility with enzyme. But that was react 17, what about 18?

ljharb commented 1 year ago

I can't support 18 until I support 17 - and again, it's about available time.

Im-Fran commented 1 year ago

Can I reach to you through twitter? Seems faster than this issue replies xD my username in twitter is ImFran I want to try and help you

ljharb commented 1 year ago

yep, same username as here, my DMs are open

simarmannsingh commented 9 months ago

I guess this PR is gonna stay open till eternity. So, just to wrap up, currently there's no support for v17, and support for v18 can only be added after v17.