-
Notifications
You must be signed in to change notification settings - Fork 47k
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
Bug: react-hooks/exhaustive-deps false positive when deps is defined with typescript const typing #20162
Comments
I'm having this issue too. |
Thanks for the report. Would you be willing to add a test to react/packages/eslint-plugin-react-hooks/__tests__/ESLintRuleExhaustiveDeps-test.js Line 7612 in bd25570
|
Hello, we are a group of researchers developing machine learning techniques to locate issues suitable for newcomers, and our model consider this issue as likely a "good first issue". May we recommend you to label it as "good first issue" so newcomers know where to choose? Thank you! |
…ray (#28189) ## Summary This PR closes #25844 The original issue talks about `as const`, but seems like it fails for any `as X` expressions since it adds another nesting level to the AST. EDIT: Also closes #20162 ## How did you test this change? Added unit tests DiffTrain build for [a1433ca](a1433ca)
…ray (facebook#28189) ## Summary This PR closes facebook#25844 The original issue talks about `as const`, but seems like it fails for any `as X` expressions since it adds another nesting level to the AST. EDIT: Also closes facebook#20162 ## How did you test this change? Added unit tests
React version: 17.0.1
Steps To Reproduce
@typescript-eslint/parser
as parseras const
to the deps arrayLink to code example: https://github.com/tranvansang/exhaustive-deps-bug-1
The current behavior
The following errors were reported
The expected behavior
The rule should interpret the deps argument correctly.
_
Why do I need to add
as const
to the deps array?I build my own custom effect hook (with the
additionalHooks
option in .eslintrc), in which a tuple typing gives more type hint to the code.The text was updated successfully, but these errors were encountered: