-
Notifications
You must be signed in to change notification settings - Fork 47.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
Bug: Types incorrectly identified as missing dependencies for [email protected]
with @typescript-eslint/[email protected]
#19742
Comments
This issue was introduced with @typescript-eslint/parser 4.0.0. |
Thanks for the information. I'll update the details. Should I move this to the |
[email protected]
with [email protected]
[email protected]
with @typescript-eslint/[email protected]
No, I already asked there, it will need to be fixed up in the react plugin. I have a fix locally, will send a PR in a moment. |
…[email protected]+ In addition to `TSTypeQuery`, dependency nodes with a `TSTypeReference` parent need to be ignored as well. Without this fix, generic type variables will be listed as missing dependencies. Example: export function useFoo<T>(): (foo: T) => boolean { return useCallback((foo: T) => false, []); } This will report the following issue: React Hook useCallback has a missing dependency: 'T'. Either include it or remove the dependency array Closes: facebook#19742
…[email protected]+ (#19751) In addition to `TSTypeQuery`, dependency nodes with a `TSTypeReference` parent need to be ignored as well. Without this fix, generic type variables will be listed as missing dependencies. Example: export function useFoo<T>(): (foo: T) => boolean { return useCallback((foo: T) => false, []); } This will report the following issue: React Hook useCallback has a missing dependency: 'T'. Either include it or remove the dependency array Closes: #19742
|
thanks! |
…[email protected]+ (facebook#19751) In addition to `TSTypeQuery`, dependency nodes with a `TSTypeReference` parent need to be ignored as well. Without this fix, generic type variables will be listed as missing dependencies. Example: export function useFoo<T>(): (foo: T) => boolean { return useCallback((foo: T) => false, []); } This will report the following issue: React Hook useCallback has a missing dependency: 'T'. Either include it or remove the dependency array Closes: facebook#19742
I'm on |
React version:
16.13.1
(although this is related to the eslint plugin).Steps To Reproduce
[email protected]
with@typescript-eslint/[email protected]
in a TypeScript project.eslint-plugin-react-hooks
responds with this errorReact Hook useMemo has a missing dependency: Item. Either include it or remove the dependency array.
Link to code example: remirror/remirror/pull/619
pnpm
. To setuppnpm
runnpm i -g pnpm
.pnpm run lint:es
to lint the codebase.The current behavior
Types are identified as missing dependencies within a hook and CI fails.
The expected behavior
Types shouldn't be identified as missing dependencies.
The text was updated successfully, but these errors were encountered: