Comments (8)
on the official react blogpost they literaly say:
PropTypes were deprecated in April 2017 (v15.5.0).
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)
from eslint-plugin-react.
@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.
from eslint-plugin-react.
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+.
from eslint-plugin-react.
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:
- react 15 or newer
- typescript=false
from eslint-plugin-react.
non-TS propTypes work fine in react 15, 16, 17, and 18, so that wouldn't make sense.
from eslint-plugin-react.
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.
from eslint-plugin-react.
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?
from eslint-plugin-react.
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
from eslint-plugin-react.
Related Issues (20)
- [Bug]: 'React' must be in scope when using JSXeslintreact/react-in-jsx-scope HOT 7
- [Bug]: `non-jsx` is listed in `react/jsx-one-expression-per-line` options but is not available HOT 1
- [Bug]: Not compatible with eslint HOT 4
- Missing type declarations HOT 3
- Failed prop type: its value is `undefined`. HOT 2
- [Bug]: react/jsx-filename-extension ignoreFilesWithoutCode option not working with eslint v8 HOT 2
- Add option to `react/destructuring-assignment` to skip destructuring on union types on `always` HOT 4
- [Bug]: `sort-prop-types`'s autofix doesn't move the semicolon, producing broken code, on single-line Props types HOT 9
- [Bug]: `prefer-read-only-props` rule doesn't work with namespaces HOT 2
- Latest version forces users to use Eslint 9.7 HOT 5
- [Bug]: `reactPlugin.configs.flat.recommended` part in documentation throws error HOT 14
- Rule proposal: No return ternary HOT 1
- [Bug]: Not working with @typescript-eslint/parser v8 HOT 4
- [Bug]: autofix for jsx-closing-bracket-location deletes comments HOT 1
- [Bug]: autofix for `sort-prop-types` breaks code containing comments
- [Bug]: `jsx-curly-brace-presence` doesn't trigger on strings containing a quote character
- [Bug]: react/prop-types false positives since upgrading typescript-eslint to v8 HOT 4
- [Feature Request]: Add TypeScript types HOT 3
- [Bug]: Cannot ban only explicitSpread for jsx-props-no-spreading HOT 2
- [Bug]: Support ESLint v9.9.0 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eslint-plugin-react.