-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable legacy lifecycle methods linting in scope of no-deprecated
rule for now
#2069
Disable legacy lifecycle methods linting in scope of no-deprecated
rule for now
#2069
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to confirm: this PR will not cause any new errors to be issued, it will only reduce errors for those with a version set low enough?
README.md
Outdated
@@ -102,7 +102,7 @@ Enable the rules that you would like to use. | |||
* [react/no-children-prop](docs/rules/no-children-prop.md): Prevent passing children as props | |||
* [react/no-danger](docs/rules/no-danger.md): Prevent usage of dangerous JSX properties | |||
* [react/no-danger-with-children](docs/rules/no-danger-with-children.md): Prevent problem with children and props.dangerouslySetInnerHTML | |||
* [react/no-deprecated](docs/rules/no-deprecated.md): Prevent usage of deprecated methods, including component lifecyle methods | |||
* [react/no-deprecated](docs/rules/no-deprecated.md): Prevent usage of deprecated methods |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this description should remain, since it's still valid given the proper version settings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
deprecated.componentWillMount = [ | ||
'16.3.0', | ||
'16.999.0', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these are a semver-patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has to be semver-MINOR, otherwise it doesn't suppress deprecation warnings for the existing React versions (16.3.0 - 16.6.3) where these component lifecycle methods aren't deprecated yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why? a minor is for adding new options - this isn't adding a new feature, it's just removing warnings for 16.3-16.6 users. Can you explain more?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might have misunderstood your first comment. What semver did you mean? React
or eslint-plugin-react
? I agree that current PR can be considered as a patch of eslint-plugin-react
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm talking about this repo :-)
bbe9436
to
f5aeced
Compare
@ljharb PR doesn't cause any new errors for To allow developers to prevent using of |
Not being in the recommended list isn't solely the issue - if |
I find it unlikely that
Thoughts? |
Certainly separating it out to get the non-breaking parts in sooner is a great idea. It'd be great, however, if we could find a way to avoid the breaking changes on no-unsafe as well. |
f5aeced
to
376f5c2
Compare
- Exclude legacy life-cycle methods from`no-deprecated` rule until it's decided which release deprecates them. - Add details regarding `rename-unsafe-lifecycles` codemod to automatically update components
376f5c2
to
70d4e71
Compare
@ljharb There're no breaking changes in updated PR now. |
As per Dan's request, legacy lifecycle methods have been "excluded" from
no-deprecated
rule for now since the methods aren't formally deprecated yet.UPDATED: The original PR has been broken down into 2 parts, the current includes changes related to
no-deprecated
rule. The 2nd PR is #2075.Summary
no-deprecated
rule until it's decided which release deprecates them. React version16.999.0
has been set forcomponentWillMount
,componentWillUpdate
,componentWillReceiveProps
lifecycle methods to disable lint errors for now.no-deprecated
rule.no-unsafe
rule has been adjusted to handle all unsafe life-cycle methods including their aliases. Developers who want to avoid using of legacy lifecycle methods can enable it today.Instructions on updating components have been adjusted inno-unsafe
rule to be consistent with React runtime warnings.@gaearon, @ljharb could you take a look?