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

Init wizard installs old version #106

Closed
elygeo opened this issue Apr 22, 2024 · 12 comments · Fixed by #113
Closed

Init wizard installs old version #106

elygeo opened this issue Apr 22, 2024 · 12 comments · Fixed by #113
Labels
accepted enhancement New feature or request

Comments

@elygeo
Copy link

elygeo commented Apr 22, 2024

Environment

Node version: v21.7.3
npm version: 10.5.2
Local ESLint version: v9.1.1
Operating System: MacOS

What parser are you using?

Default (Espree)

What did you do?

$ npm init @eslint/config@latest
(accept defaults)

$ npx eslint --version

What did you expect to happen?

v9.1.1

What actually happened?

v8.57.0

@elygeo elygeo added bug Something isn't working repro:needed labels Apr 22, 2024
@nzakas
Copy link
Member

nzakas commented Apr 22, 2024

Duplicate of eslint/eslint#18369

@nzakas nzakas marked this as a duplicate of eslint/eslint#18369 Apr 22, 2024
@nzakas nzakas closed this as not planned Won't fix, can't repro, duplicate, stale Apr 22, 2024
@nzakas nzakas reopened this Apr 22, 2024
@nzakas
Copy link
Member

nzakas commented Apr 22, 2024

Moving this over to the create-config repo as this isn't tied to anything ESLint is doing.

@nzakas nzakas transferred this issue from eslint/eslint Apr 22, 2024
@nzakas
Copy link
Member

nzakas commented Apr 23, 2024

@aladdin-add can you take a look at this?

@aladdin-add
Copy link
Member

aladdin-add commented Apr 24, 2024

I was able to repro!

However, it's expected behavior: the required deps eslint-plugin-react does not allow eslint v9. So, package managers like npm will install v8 instead; while yarn v1 will install eslint v9. 🤔

https://github.com/jsx-eslint/eslint-plugin-react/blob/4467db503e38b9356517cf6926d11be544ccf4b1/package.json#L81

you can use "npm install eslint@9 --force" to accept a "broken" deps tree. But the safest way is using eslint v8 before v9 is officially supported.

@nzakas
Copy link
Member

nzakas commented Apr 24, 2024

Should we maybe detect this and then ask if people want to override and force ESLint 9 to be installed?

@aladdin-add
Copy link
Member

I don't think it's appropriate (at least for most users) - eslint v9 is not supported by the plugin, and not even tested. We can output some information, the advanced users can upgrade to v9 manually if they are willing to try, just like use-at-your-own-risks.

@aladdin-add
Copy link
Member

some known issues: jsx-eslint/eslint-plugin-react#3699

@nzakas
Copy link
Member

nzakas commented Apr 25, 2024

What part isn't appropriate?

I think telling people that they're using a plugin that isn't supported in v9 and then giving them the option to continue or install v8 makes sense in all cases. Is there something I'm missing?

@aladdin-add
Copy link
Member

It doesn't seem reasonable to install a version that may not work. good to use @eslint/backcompat as described in eslint/rewrite#4.

@nzakas
Copy link
Member

nzakas commented Apr 29, 2024

Sorry, I think maybe I'm not explaining myself well.

What I think we should do for now is, if they select React, to message them saying, "The React plugin works in ESLint < 9.0.0. Would you like to install ESLint 8.57?" (or something like that) To make it obvious what is happening. If they answer "No", then we just don't add the plugin. Does that make sense?

And yes, once the compat utility is published, we can always go back and wrap the plugin and avoid this mess.

@aladdin-add
Copy link
Member

I see, thanks for explaining. SGTM. 👍

@nzakas
Copy link
Member

nzakas commented May 9, 2024

aladdin-add added a commit that referenced this issue May 10, 2024
aladdin-add added a commit that referenced this issue May 10, 2024
aladdin-add added a commit that referenced this issue May 10, 2024
nzakas pushed a commit that referenced this issue May 13, 2024
* fix: use eslint v9 when choosing react

fixes #106

* fix: use `--force`

* chore: add a note

* fix: ask installing eslint v8/v9

* chore: add more tests

* fix: rm an unused assignment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants