eslint-config icon indicating copy to clipboard operation
eslint-config copied to clipboard

Unable to use `react` config on ESLint v9

Open fregante opened this issue 1 year ago • 1 comments

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

  1. Add legacy-peer-deps=true to your .npmrc file
  2. Add a react key to your antfu() config
  3. Run npm install -D eslint-plugin-react-hooks@beta
  4. Run eslint

Related issues to follow

  • https://github.com/facebook/react/issues/28313
  • https://github.com/antfu/eslint-config/issues/571

fregante avatar Jul 31 '24 16:07 fregante

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)

rvanbaalen avatar Aug 15 '24 17:08 rvanbaalen

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.

thien-do avatar Oct 11 '24 14:10 thien-do