-
Notifications
You must be signed in to change notification settings - Fork 26.8k
react/sort-comp: getDerivedStateFromProps #1850
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
Comments
Yes - the bug was in eslint-plugin-react (you'd see the change on v16 as well, with a fully updated eslint-plugin-react). Specifically, gDSFP is both a static method and a lifecycle method, and the sorting logic was wrong. See jsx-eslint/eslint-plugin-react#1795 / jsx-eslint/eslint-plugin-react#1793 |
Apologies! I do not see gDSFP here at all though (assuming this overrides what eslint-plugin-react does?) https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb/rules/react.js
|
Ooh, good call - we do override the defaults. I think the change (which would still have shown up in v16) is that gDSFP in "statics" vs "lifecycle" changed. In other words, |
Okay cool. I was in refactor mode with my npm updated and was hoping not to have to move em around again too much. Do you think the order will change at all for 17.x (even if it is just to match the react plugin)? Internally debating if I delay the class method shuffle or not. Appreciate all the feedback and thanks for your time on my isssues / questions today! |
I do not expect the ordering to change further (although there may be new React lifecycle methods added to the "lifecycle" group) |
To be clear, you do see it moving to statics right? Not below componentDidUpdate (my current error, plugin is updated). |
Since |
After updating to v17, I am getting 'getDerivedStateFromProps should be placed after componentDidUpdate`. I want to say previously in v16 the rule was below the constructor... does the new placement make sense?
The text was updated successfully, but these errors were encountered: