You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Remove react/prop-types from the recommended config #3753
In React 19, we’re removing the propType checks from the React package, and using them will be silently ignored. If you’re using propTypes, we recommend migrating to TypeScript or another type-checking solution.
I suppose it can wait for v19 official release, but given this change I think the rule react/prop-types should be removed from the recommended configuration.
i dont think deprecated functionality should be in the recommended ruleset. Since it encourages users to add depricated functionality to their project. (even though it still works, and will be silently ignored in the next version of react)
Reacted by Armon Raphiel, Jon Dufresne, Justin Coyne, Florian Ebeling and Wyatt Ades
Something that adds a lot of value, such that it’s been 7 years and it’s still not removed, is worth recommending. “the project team says it’s icky” isn’t a good reason not to do so.
also for people that are not using typescript?
i really dont understand why you would recommend users to add proptypes in react 18, if they will be removed in react 19?
such that it’s been 7 years and it’s still not removed
The React team takes backwards-compatibility seriously. Not removing it right away (in the next major) doesn't make it "less deprecated".
is worth recommending. “the project team says it’s icky” isn’t a good reason not to do so.
I'm really confused. The "react" ESLint plugin is actively recommending the usage of deprecated APIs?
New projects will be recommended to add extra code that has been deprecated and recommended against by the React team for years now.
I can definitely understand this rule existing for teams to opt-in. But as a recommended configuration... I can't see how this isn't actively working against React's evolution and progress.
Is this up for debate? Or isn't it worth it because you disagree with it @ljharb? I really can't think of a better reason that recommended deprecated/removed APIs
@zettca the rule checks for more than just propTypes. The propTypes checks should be always automatically disabled in react 19+. I'm perfectly content to add an option that allows you to opt out of these checks in an earlier react version, if you're using a react that supports propTypes and don't wish to benefit from them.
As for the recommended config, it predates me and I don't suggest people use it. The thing I recommend people do is use this plugin via the airbnb config.
If I ever do a semver major, the recommended config is going to either be removed entirely, or, just match the airbnb config's react config.
Activity
ljharb commentedon May 11, 2024
It shouldn’t be removed ever - it also enforces TS types.
However, it shouldn’t allow or suggest/push runtime propTypes if the react version is 19+.
Jimbolino commentedon Jun 24, 2024
Today I started adding propTypes to all my components after running eslint for the first time on a new react project.
maybe the rule can be disabled automagically if:
ljharb commentedon Jun 24, 2024
non-TS propTypes work fine in react 15, 16, 17, and 18, so that wouldn't make sense.
Jimbolino commentedon Jun 25, 2024
on the official react blogpost they literaly say:
i dont think deprecated functionality should be in the recommended ruleset. Since it encourages users to add depricated functionality to their project. (even though it still works, and will be silently ignored in the next version of react)
ljharb commentedon Jun 25, 2024
Something that adds a lot of value, such that it’s been 7 years and it’s still not removed, is worth recommending. “the project team says it’s icky” isn’t a good reason not to do so.
Jimbolino commentedon Jun 25, 2024
also for people that are not using typescript?
i really dont understand why you would recommend users to add proptypes in react 18, if they will be removed in react 19?
zettca commentedon Jun 25, 2024
The React team takes backwards-compatibility seriously. Not removing it right away (in the next major) doesn't make it "less deprecated".
I'm really confused. The
"react"ESLint plugin is actively recommending the usage of deprecated APIs?New projects will be recommended to add extra code that has been deprecated and recommended against by the React team for years now.
I can definitely understand this rule existing for teams to opt-in. But as a recommended configuration... I can't see how this isn't actively working against React's evolution and progress.
Is this up for debate? Or isn't it worth it because you disagree with it @ljharb? I really can't think of a better reason that recommended deprecated/removed APIs
ljharb commentedon Jun 25, 2024
@zettca the rule checks for more than just propTypes. The propTypes checks should be always automatically disabled in react 19+. I'm perfectly content to add an option that allows you to opt out of these checks in an earlier react version, if you're using a react that supports propTypes and don't wish to benefit from them.
As for the recommended config, it predates me and I don't suggest people use it. The thing I recommend people do is use this plugin via the airbnb config.
If I ever do a semver major, the recommended config is going to either be removed entirely, or, just match the airbnb config's react config.
Disable react/prop-types eslint rule
Disable react/prop-types project-wide; drop dead PropTypes from Toggl…