-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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
react-hooks/rules-of-hooks: detect issues in property definitions #27435
base: main
Are you sure you want to change the base?
Conversation
Hi @ecraig12345! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
Comparing: d900fad...3c30b39 Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) |
This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated. |
bump |
PR has merge conflicts. Can you rebase this onto latest |
This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated. |
bump |
Summary
As detailed in #27431, with the eslint parser set to
@typescript-eslint/parser
v5 or newer, this code was no longer being flagged byeslint-plugin-react-hooks
rules-of-hooks
:This was due to a change in
@typescript-eslint/parser
v5, where the AST node typeClassProperty
was renamed toPropertyDefinition
. So the fix is to also check forPropertyDefinition
in the lint rule.Open question: Is this considered a breaking change? These violations would have been flagged with
@typescript-eslint/parser
v4 and older, but if a repo upgraded to >= v5, new violations could have been introduced, which would cause build breaks when the rule is updated.Fixes #27431
How did you test this change?
rules-of-hooks
tests to run with more parsers (including typescript-eslint v4 and v5) and verified that they passeslint-plugin-react-hooks
in another repo (wasn't sure how to build the plugin from my local react repo) and verified the error was flagged