Unable to use `react` config on ESLint v9
This is not strictly a bug with the config, but it's because the stable version of eslint-plugin-react-hooks (v4) does not have ESLint 9 as a peer config.
As suggested by @thien-do in https://github.com/antfu/eslint-config/issues/558#issuecomment-2253039214, you can install the beta version.
Steps to fix it temporarily
- Add
legacy-peer-deps=trueto your .npmrc file - Add a
reactkey to yourantfu()config - Run
npm install -D eslint-plugin-react-hooks@beta - Run eslint
Related issues to follow
- https://github.com/facebook/react/issues/28313
- https://github.com/antfu/eslint-config/issues/571
Can confirm this is still an issue. Use the config CLI or manual config with react: true and you can't install the dependencies due to incompatibility between peer deps.
Using the above steps resolved the issue (allowing legacy peer deps and installing eslint-plugin-react-hooks@beta)
eslint-plugin-react-hooks version 5 is released with ESLint v9 support 🎉
https://github.com/facebook/react/issues/28313#issuecomment-2407428442
Tried locally and everything seems to work. There's still a warning on install as @antfu/eslint-config will need to allow v5 as its peer dependency I think.