Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot upgrade eslint to v9 due to eslint-plugin-react-hooks peer dependancies #30932

Closed
DeadEnglish opened this issue Sep 10, 2024 · 8 comments
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@DeadEnglish
Copy link

DeadEnglish commented Sep 10, 2024

eslint-plugin-react-hooks does not currently support the latest version on eslint, [email protected]

React version: 18.3.1

Steps To Reproduce

  1. create a new react application
  2. install eslint @ 8.56.0
  3. install eslint-plugin-react-hooks @ 4.6.2
  4. try to install eslint @ 9.10.0

Link to code example:

The current behavior

cannot install due to eslint-plugin-react-hooks only having eslint version 8 as a peer dependancy.

npm i output:

npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: [email protected]
npm error Found: [email protected]
npm error node_modules/eslint
npm error   dev eslint@"^9.10.0" from the root project
npm error   peer eslint@"^7.5.0 || ^8.0.0 || ^9.0.0" from @babel/[email protected]
npm error   node_modules/@babel/eslint-parser
npm error     dev @babel/eslint-parser@"^7.25.1" from the root project
npm error   6 more (@eslint-community/eslint-utils, ...)
npm error
npm error Could not resolve dependency:
npm error peer eslint@"^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0" from [email protected]
npm error node_modules/eslint-plugin-react-hooks
npm error   dev eslint-plugin-react-hooks@"^4.6.2" from the root project
npm error
npm error Conflicting peer dependency: [email protected]
npm error node_modules/eslint
npm error   peer eslint@"^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0" from [email protected]
npm error   node_modules/eslint-plugin-react-hooks
npm error     dev eslint-plugin-react-hooks@"^4.6.2" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error

The expected behavior

ES lint is upgraded successfully

@DeadEnglish DeadEnglish added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Sep 10, 2024
@DeadEnglish DeadEnglish reopened this Sep 10, 2024
@DeadEnglish
Copy link
Author

DeadEnglish commented Sep 10, 2024

Seems like the changes have been added to the library here but a new version is yet to be released on NPM

@bsal649
Copy link

bsal649 commented Sep 11, 2024

You can install the eslint-plugin-react-hooks RC to get around this for now.

npm i eslint-plugin-react-hooks@rc

@nikolailehbrink
Copy link

You can install the eslint-plugin-react-hooks RC to get around this for now.

npm i eslint-plugin-react-hooks@rc

That doesn't work for me unfortunately. Any idea?

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/eslint
npm ERR!   dev eslint@"^9.10.0" from the root project
npm ERR!   peer eslint@"^6.0.0 || ^7.0.0 || >=8.0.0" from @eslint-community/[email protected]
npm ERR!   node_modules/@eslint-community/eslint-utils
npm ERR!     @eslint-community/eslint-utils@"^4.2.0" from [email protected]
npm ERR!     @eslint-community/eslint-utils@"^4.4.0" from @typescript-eslint/[email protected]
npm ERR!     node_modules/@typescript-eslint/utils
npm ERR!       @typescript-eslint/utils@"8.5.0" from @typescript-eslint/[email protected]
npm ERR!       node_modules/@typescript-eslint/eslint-plugin
npm ERR!         dev @typescript-eslint/eslint-plugin@"^8.5.0" from the root project
npm ERR!       1 more (@typescript-eslint/type-utils)
npm ERR!   7 more (@typescript-eslint/eslint-plugin, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer eslint@"^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" from [email protected]
npm ERR! node_modules/eslint-plugin-import
npm ERR!   dev eslint-plugin-import@"^2.30.0" from the root project
npm ERR!   peerOptional eslint-plugin-import@"*" from [email protected]
npm ERR!   node_modules/eslint-import-resolver-typescript
npm ERR!     dev eslint-import-resolver-typescript@"^3.6.3" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/eslint
npm ERR!   peer eslint@"^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" from [email protected]
npm ERR!   node_modules/eslint-plugin-import
npm ERR!     dev eslint-plugin-import@"^2.30.0" from the root project
npm ERR!     peerOptional eslint-plugin-import@"*" from [email protected]
npm ERR!     node_modules/eslint-import-resolver-typescript
npm ERR!       dev eslint-import-resolver-typescript@"^3.6.3" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

@bsal649
Copy link

bsal649 commented Sep 15, 2024

@nikolailehbrink your issue is with eslint-plugin-import. I don’t use it personally, but you could try see if they have an rc/beta/preview branch with eslint 9 support.

fuhrmanator added a commit to ets-cfuhrman-pfe/EvalueTonSavoir that referenced this issue Sep 16, 2024
dgdavid added a commit to agama-project/agama that referenced this issue Sep 16, 2024
Which has implied,

* Drop eslint-plugin-import in favor of eslint-plugin-import-x

  Since the eslint-plugin-import support for ESLint 9 is kind of a
  blocker for such an update at this moment. See import-js/eslint-plugin-import#2948

* Update eslint-plugin-react-hooks to an RC version

  For moving this update on without waiting until the support reach the
  @latest version. See facebook/react#30932 (comment)

As commented at
import-js/eslint-plugin-import#2948 (comment),

>  the ESLint plugin ecosystem is getting harder and harder to maintain,
>  and things get worse during major version upgrades.
@bsShoham
Copy link

@nikolailehbrink you can also use eslint plugin perfectionist as it has a similar feature of import ordering to eslint-plugin-import, and supports eslint v9

@DeadEnglish
Copy link
Author

thanks @bsal649, whilst using the release candidate as work around does indeed fix the issue (and may be useful for other projects), RCs seem to be updated daily. I'm mainly worried about platform stability and ideally require a stable release version for our application.

@DAcodedBEAT
Copy link

DAcodedBEAT commented Sep 19, 2024

I believe this related to #28313

@eps1lon
Copy link
Collaborator

eps1lon commented Sep 25, 2024

Fixed in #28773. Will be released alongside React 19 as stable. You can use it today by install eslint-plugin-react-hooks@rc.

@eps1lon eps1lon closed this as completed Sep 25, 2024
m-tartari added a commit to m-tartari/m-tartari.github.io that referenced this issue Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

No branches or pull requests

7 participants
@DAcodedBEAT @DeadEnglish @eps1lon @nikolailehbrink @bsal649 @bsShoham and others