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
fix: use @eslint/compat to fix eslint v9 + react plugin #113
Conversation
53b12bf
to
9fd8cee
Compare
dfa8026
to
45949b2
Compare
lib/config-generator.js
Outdated
@@ -68,7 +68,7 @@ export class ConfigGenerator { | |||
message: "Which framework does your project use?", | |||
initial: 0, | |||
choices: [ | |||
{ message: "React", name: "react" }, | |||
{ message: "React (⚠️eslint v9 has not been officially supported.)", name: "react" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added a note, as it will output an warning when using npm install --force
:
The config that you've selected requires the following dependencies:
eslint@^9.2.0, globals, @eslint/js, eslint-plugin-react, @eslint/compat
✔ Would you like to install them now? · No / Yes
✔ Which package manager do you want to use? · npm
☕️Installing...
npm WARN using --force Recommended protections disabled.
npm WARN idealTree Removing dependencies.eslint in favor of devDependencies.eslint
npm WARN idealTree Removing dependencies.globals in favor of devDependencies.globals
npm WARN idealTree Removing dependencies.@eslint/js in favor of devDependencies.@eslint/js
npm WARN idealTree Removing dependencies.eslint-plugin-react in favor of devDependencies.eslint-plugin-react
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: example@1.0.0
npm WARN Found: eslint@8.57.0
npm WARN node_modules/eslint
npm WARN peer eslint@"^6.0.0 || ^7.0.0 || >=8.0.0" from @eslint-community/eslint-utils@4.4.0
npm WARN node_modules/@eslint-community/eslint-utils
npm WARN @eslint-community/eslint-utils@"^4.2.0" from eslint@8.57.0
npm WARN 2 more (eslint-plugin-react, the root project)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer eslint@"^3 || ^4 || ^5 || ^6 || ^7 || ^8" from eslint-plugin-react@7.34.1
npm WARN node_modules/eslint-plugin-react
npm WARN dev eslint-plugin-react@"*" from the root project
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: eslint-plugin-react@7.34.1
npm WARN Found: eslint@9.2.0
npm WARN node_modules/eslint
npm WARN dev eslint@"^9.2.0" from the root project
npm WARN 1 more (@eslint-community/eslint-utils)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer eslint@"^3 || ^4 || ^5 || ^6 || ^7 || ^8" from eslint-plugin-react@7.34.1
npm WARN node_modules/eslint-plugin-react
npm WARN dev eslint-plugin-react@"*" from the root project
npm WARN
npm WARN Conflicting peer dependency: eslint@8.57.0
npm WARN node_modules/eslint
npm WARN peer eslint@"^3 || ^4 || ^5 || ^6 || ^7 || ^8" from eslint-plugin-react@7.34.1
npm WARN node_modules/eslint-plugin-react
npm WARN dev eslint-plugin-react@"*" from the root project
added 5 packages, removed 3 packages, and changed 19 packages in 30s
36 packages are looking for funding
run `npm fund` for details
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will confuse people. What if we just kept this as "React", and then, if it is selected, output another message:
The React plugin doesn't officially support ESLint v9 yet. What would you like to do?
- Install ESLint v9.x with compatibility utilities
- Install ESLint v8.x
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 sounds good, will make a change later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
fixes #106
eslint/compat
for react plugin.--force
when installing dev deps.the generated snapshots:
v8: https://github.com/eslint/create-config/blob/4517b301f2f46e4fdf367b03bd1d69f76813632a/tests/__snapshots__/syntax-esm-react-eslint8.x-javascript
v9:https://github.com/eslint/create-config/blob/4517b301f2f46e4fdf367b03bd1d69f76813632a/tests/__snapshots__/syntax-esm-react-eslint9.x-javascript