react
react copied to clipboard
cannot upgrade `eslint` to v9 due to `eslint-plugin-react-hooks` peer dependancies
eslint-plugin-react-hooks does not currently support the latest version on eslint, [email protected]
React version: 18.3.1
Steps To Reproduce
- create a new react application
- install
eslint@ 8.56.0 - install
eslint-plugin-react-hooks@ 4.6.2 - 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
Seems like the changes have been added to the library here but a new version is yet to be released on NPM
You can install the eslint-plugin-react-hooks RC to get around this for now.
npm i eslint-plugin-react-hooks@rc
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.
@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.
@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
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.
I believe this related to https://github.com/facebook/react/issues/28313
Fixed in https://github.com/facebook/react/pull/28773. Will be released alongside React 19 as stable. You can use it today by install eslint-plugin-react-hooks@rc.