Bug [ESLint Hooks Plugin]: When using a `typeof` type guard it requires the value as a dependency
See original GitHub issueVersion: eslint-plugin-react-hooks@1.7.0
Steps To Reproduce
- Create a component with local state
- Create a useEffect with a variable inside, that points to the
typeof
of the state variable
Link to code example:
https://codesandbox.io/s/nervous-williamson-2i99l?file=/src/App.tsx:210-261
The current behavior
react-exhaustive-deps
complains that the state variable should be included in the dependency list
The expected behavior
react-exhaustive-deps
shouldn’t complain that the state variable should be included in the dependency list because it’s value is never used.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Why eslint-plugin-react-hooks doesn't warn when using react ...
I added the following dependencies: @typescript-eslint/eslint-plugin and @typescript-eslint/parser to package.json and added the following to .eslintrc.js :
Read more >Design Patterns with React Easy State | by Bertalan Miklos
Easy State is a practical Proxy-based state management library for React. Learn how to create applications with it through an app, which pairs...
Read more >eslint-config-torchbox - npm
Shareable ESLint config following Torchbox's code style. ... Start using eslint-config-torchbox in your project by running `npm i eslint-config-torchbox`.
Read more >eslint | Yarn - Package Manager
ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code. In many ways, it is similar to JSLint and...
Read more >CoffeeScript
coffee script into a .js JavaScript file of the same name. -t, --transpile, Pipe the CoffeeScript compiler's output through Babel before saving ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@delca85 Please go ahead, it’s been a while!
@delca85 fixed this in #19316. If you find other similar issues, please report them too! Thanks.
eslint-plugin-react-hooks@4.0.8
should have the fix.