jsx-eslint / eslint-plugin-react

React-specific linting rules for ESLint
MIT License
8.97k stars 2.77k forks source link

[Bug]: Unable to use with eslint 9.x #3760

Closed lewismoten closed 4 months ago

lewismoten commented 4 months ago

Is there an existing issue for this?

Description Overview

eslint-plugin-react v7.34.1 only works with older versions of eslint (3-8). The current version is 9.3.0

npm init
npm i eslint -D
npm i eslint-plugin-react -D

Everywhere. This is a new project.

The plugin isn't marked to be compatible with future versions of eslint after 8.x. Eslint is currently at version 9.3

newproject git:(master) npm i eslint-plugin-react -D
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: newproject@0.0.0
npm error Found: eslint@9.3.0
npm error node_modules/eslint
npm error   dev eslint@"^9.3.0" from the root project
npm error
npm error Could not resolve dependency:
npm error peer eslint@"^3 || ^4 || ^5 || ^6 || ^7 || ^8" from eslint-plugin-react@7.34.1
npm error node_modules/eslint-plugin-react
npm error   dev eslint-plugin-react@"*" 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
npm error
npm error For a full report see:
npm error /Users/lewismoten/.npm/_logs/2024-05-22T05_46_15_548Z-eresolve-report.txt

npm error A complete log of this run can be found in: /Users/lewismoten/.npm/_logs/2024-05-22T05_46_15_548Z-debug-0.log

npm i eslint-plugin-react -D

Expected Behavior

The plugin should have installed and appear as a devDependency in the package.json file.

  "devDependencies": {
    "eslint": "^9.3.0",
    "eslint-plugin-react": "^7.34.1"
  }

eslint-plugin-react version

v7.34.1

eslint version

v9.3.0

node version

v22.2.0

ljharb commented 4 months ago

It's not a bug; we're not compatible with eslint 9 and you shouldn't upgrade yet.

Duplicate of #3699.