create-config
create-config copied to clipboard
Init wizard installs old version
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
Duplicate of https://github.com/eslint/eslint/issues/18369
Moving this over to the create-config repo as this isn't tied to anything ESLint is doing.
@aladdin-add can you take a look at this?
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.
Should we maybe detect this and then ask if people want to override and force ESLint 9 to be installed?
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.
some known issues: https://github.com/jsx-eslint/eslint-plugin-react/issues/3699
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?
It doesn't seem reasonable to install a version that may not work. good to use @eslint/backcompat as described in https://github.com/eslint/rewrite/issues/4.
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.
I see, thanks for explaining. SGTM. 👍
Compat utility is ready: https://eslint.org/blog/2024/05/eslint-compatibility-utilities/