dillon1000/react

Commit

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: #19742
Browse files
Changed paths1 file
First-parent comparison
M packages/eslint-plugin-react-hooks/src/ExhaustiveDeps.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…