React version: 16.13.1 (although this is related to the eslint plugin).
Steps To Reproduce
- Install
eslint-plugin-react-hooks@4.1.0 with @typescript-eslint/parser@4.0.1 in a TypeScript project.
- Within your hook define a type, or cast a value to a certain type`
const actions = useMemo(
() => bindActionCreators(MultishiftActions, dispatch) as Partial<Item>,
[dispatch],
);
eslint-plugin-react-hooks responds with this error React Hook useMemo has a missing dependency: Item. Either include it or remove the dependency array.
Link to code example: remirror/remirror/pull/619
- Checkout the remirror codebase
git clone https://github.com/remirror/remirror
git checkout typedoc
- Install the dependencies with
pnpm. To setup pnpm run npm i -g pnpm.
- Run the command
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.