-
-
Notifications
You must be signed in to change notification settings - Fork 27
fix: relax @eslint/compat
eslint peerDependencies constraint
#215
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
Conversation
|
Seems like a safe change to me. @fasttime because you were involved in the original discussion, what do you think? |
We added a peer dependency on Apart from that, it's difficult to say if the change in this PR is safe or not because we don't have unit tests for ESLint v8. I can see 13 failing tests when I run |
If we are worried about breaking v8 accidentally in the future, I think this is what should be done to be SemVer compliant:
|
@kellyselden that would introduce a potentially breaking change into the 1.x line, which is the concern here. @fasttime which tests failed? |
@nzakas Do you expect there to be further 1.x development after releasing v2? If so, could we revert the breaking change as an option? |
@nzakas To test with ESLint v8.57.1, I run these commands: cd packages/compat
npm i -D eslint@8
npm run build
npm test And I got test failures:
On the other hand, I think the intent of this pull request is not to add compatibility with ESLint v8 (which would be a new feature), but rather to allow installing the package alongside an old version of ESLint. In that case, the test failures should be probably irrelevant. |
@kellyselden you've lost me. There's no plan for a v2 so I don't know what you're asking. |
@fasttime I took a look at the tests and the failures are just because ESLint v8 defaults to eslintrc while ESLint v9 defaults to flat config. If I change the tests to explicitly pass |
You're right! I can see the tests passing with ESLint versions down to v8.40.0 if |
I'm not sure it's helpful to update the tests as we're not running them with ESLint v8, and anyone using ESLint v8 would necessarily be using flat config with this package. |
ping @fasttime |
I don't feel strongly about the peer dependency. Maybe the version range should be stricter, e.g. |
On closer look, if the tests are updated to use I'm not sure at this point what lower bound for the |
Then let's set the lower bound at v8.40.0? |
98202b3
to
0118a99
Compare
Updated to 8.40 minimum. |
packages/compat/package.json
Outdated
@@ -56,7 +56,7 @@ | |||
"typescript": "^5.4.5" | |||
}, | |||
"peerDependencies": { | |||
"eslint": "^9.10.0" | |||
"eslint": "8.40 | 9" |
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.
Minimum version 8.40 makes sense, but I think there should be a caret before 8.40
to allow installing ESLint versions v8.41.0-v8.57.1, i.e. where the minor version number is higher than 40. See https://github.com/npm/node-semver?tab=readme-ov-file#caret-ranges-123-025-004. The logical or is written with a double pipe (||
).
"eslint": "8.40 | 9" | |
"eslint": "^8.40 || 9" |
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.
Thanks. Fixed.
0118a99
to
30f5884
Compare
Updated to the suggestion in eslint#106 (comment). This was a breaking change, causing a refresh of our lockfile to generate the following error: ``` ERR_PNPM_PEER_DEP_ISSUES Unmet peer dependencies XXX └─┬ @eslint/compat 1.2.9 └── ✕ unmet peer eslint@^9.10.0: found 8.57.0 ``` This resolves the breaking change, since I believe @eslint/compat was introduced during the v8 eslint cycle and we don't need to go lower.
30f5884
to
6d9c1e3
Compare
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. Would like @fasttime to review before merging.
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!
Updated to the suggestion in #106 (comment). This was a breaking change, causing a refresh of our lockfile to generate the following error:
This resolves the breaking change, since I believe @eslint/compat was introduced during the v8 eslint cycle and we don't need to go lower.
Prerequisites checklist
What is the purpose of this pull request?
To resolve a breaking change in @eslint/compat.
What changes did you make? (Give an overview)
Added eslint v8 to the peer dependencies.
Related Issues
#106 (comment)
Is there anything you'd like reviewers to focus on?