-
Notifications
You must be signed in to change notification settings - Fork 1
feat: make eslint
a peer dependency
#1
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
Hi @marcalexiei, the problem is that Unfortunately, I don't have capacities to support multiple versions of ESLint in this project, although the documentation could be improved. |
Thanks for the explanation, "peerDependencies": {
- "eslint": "^9"
+ "eslint": ">= 9.14.0 < 9.15"
}, Consider the following scenario:
Assuming I'm using an editor with eslint support the editor will pick
This kind of scenario should be prevented if using What do you think? |
Yes, the idea is that you shouldn't need to install
|
Gotcha, eslint-p/test/eslint-lint-parallel.js Line 22 in 9e2e143
If the version isn't included in the supported list we can report a warning to the user. If you want I can submit a PR with this change otherwise I can setup another PR updating the docs with this information. |
Thanks! Feel free to update the docs with what is missing. I'm not sure yet about reporting a warning to the user if there's a version mismatch. I see two problems:
I'd suggest to reconsider this change later if users have trouble with a particular use case. |
Sure! I'll open it in the upcoming days.
Ok, no problem. I would like to add some thoughts for future reference about the implementation I had in mind: Assuming we use The given path can be used to load ESLint dynamically like already done here: eslint-p/test/eslint-lint-parallel.js Line 22 in 9e2e143
After loading Something like: const eslintPath = await import.meta.resolve('eslint');
// check if path do not exist and issue an error
const { ESLint } = await import('eslint');
// get ESLint version
const installedVersion = ESLint.version;
// check version using string compare and if version is not supported issue a warning With this method we can get the exact version of installed You can close the PR if you do not want to discuss this further 🙂. |
Greetings,
this PR change moves
eslint
topeerDependencies
.This ensures that only a version of
eslint
is present.I tried this library on a project with
eslint@9.13.0
andeslint@9.14.0
was installed ineslint-p
node_modules
folder.