dillon1000/react
Commit
Browse files eslint-plugin-react-hooks: fix compatibility with @typescript-eslint/[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: #19742Changed paths1 file
First-parent comparisonpackages/eslint-plugin-react-hooks/src/ExhaustiveDeps.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…