-
-
Notifications
You must be signed in to change notification settings - Fork 637
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
[New] add eslint 9 support #1009
Conversation
This change adds support for eslint v9. All three example projects have been updated to use the latest eslint, and the root package's dev and peer deps have been updated. In order to make this work with both v9 and older versions, I had to update the parser options helper to adjust the config passed into the `RuleTester`.
package.json
Outdated
"jest": "^24.9.0", | ||
"jest": "^29.7.0", |
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.
we can't upgrade jest, because jest 24 is the last version that supports node 6.
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.
Hmm. Ok, but jest 24 isn't able to resolve node:fs/promises
which eslint uses (so we hit this when importing RuleTester
from eslint). I could map node:fs/promises
to something like fs-extra
using jest's moduleNameMapper
? So the project is never going higher than jest 24?
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.
at some point we'll have a breaking change that drops older eslints/nodes, but i'm more likely to bail on jest entirely and use something less frictiony regardless.
can you map node:fs/promises
to fs/promises
, instead? the node:
prefix is pretty useless.
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.
After a few iterations, I got it working. I ended up having to map several built in node modules, as well as a couple of esm entry points of eslint packages, I also had to add a polyfill for structuredClone
, which eslint uses as part of RuleTester
and was added in node 17.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
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.
Everything's green now, if you want to take another look when you have the time. It may be worth considering dynamically installing a newer jest for v9 and removing all of those workarounds (in the same way each eslint version is being installed), but I'll leave that to you.
3db1f8c
to
4f21b85
Compare
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
|
f99300c
to
1231f61
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1009 +/- ##
==========================================
- Coverage 99.03% 98.73% -0.30%
==========================================
Files 107 107
Lines 1660 1666 +6
Branches 588 591 +3
==========================================
+ Hits 1644 1645 +1
- Misses 16 21 +5 ☔ View full report in Codecov by Sentry. |
f8e70cd
to
903bca2
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.
Seems good!
903bca2
to
deac4fd
Compare
it's now released; v6.10.0. |
@ljharb I think something is missing, there's no |
oh thanks, i always forget github releases (which don't matter; only npm matters) |
Oh, you're right, I didn't check npm 🙈 sorry. |
> [!WARNING] > **Breaking Change:** Now uses `[email protected]` which has a new violation disallowing Component names starting with anything but an uppercase letter. See https://github.com/facebook/react/releases/tag/eslint-plugin-react-hooks%405.0.0 for more details. Adds support of ESLint v9 to `eslint-plugin-next`, `eslint-config-next` and `next lint`. Does not require using the new flat config format. `next lint` will automatically ensure the old config format can be used. ### Why? As `eslint-plugin-react-hooks` has been updated for ESLint v9 support and is a helpful package for Next v15 upgrade, unblock the restrictions to upgrade to ESLint v9. Also, ESLint v8 is [End of Life](https://eslint.org/blog/2024/09/eslint-v8-eol-version-support/#:~:text=ESLint%20v8.-,x%20end%20of%20life%20is%20October%205%2C%202024,x%20on%20October%205%2C%202024.) support since Oct 5th, so is good to unblock v9 now. Plugins bumped: - [x] [@rushstack/eslint-patch](microsoft/rushstack#4719) ([v1.10.3](https://www.npmjs.com/package/@rushstack/eslint-patch/v/1.10.3?activeTab=versions) no release post, confirmed on NPM) - [x] [@typescript-eslint/eslint-plugin](typescript-eslint/typescript-eslint#9002) ([v8.0.0](typescript-eslint/typescript-eslint#9002 (comment))) - [x] [eslint-plugin-import](import-js/eslint-plugin-import#2996) ([v2.31.0](https://github.com/import-js/eslint-plugin-import/releases/tag/v2.31.0)) - [x] [eslint-plugin-jsx-a11y](jsx-eslint/eslint-plugin-jsx-a11y#1009) ([v6.10.0](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/releases/tag/v6.10.0)) - [x] [eslint-plugin-react](jsx-eslint/eslint-plugin-react#3759) ([v7.35.0](https://github.com/jsx-eslint/eslint-plugin-react/releases/tag/v7.35.0)) - [x] [eslint-plugin-react-hooks](facebook/react#28773) ([v5.0.0](https://github.com/facebook/react/releases/tag/eslint-plugin-react-hooks%405.0.0)) We have to switch to ESLint v9 in our repo due to a pnpm bug where it automatically uses ESLint v9 even though we only installed it via `eslint-v9: npm:[email protected]`. This is a pnpm bug that wouldn't happen with Yarn v1, v4 nor NPM. Closes #64409 Closes #64114 Closes #64453 Closes NEXT-3293 --------- Co-authored-by: Sebastian "Sebbie" Silbermann <[email protected]>
This change adds support for eslint v9. All three example projects have been updated to use the latest eslint, and the root package's dev and peer deps have been updated.
In order to make this work with both v9 and older versions, I had to update the parser options helper to adjust the config passed into the
RuleTester
. It was also necessary update jest to a newer version, in order to resolve eslint's use ofnode:fs/promises
.Note: the removed test cases are exact duplicates of other tests. v9 fails tests when its determined to be an exact duplicate.
Closes: #978