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

[New] add eslint 9 support #1009

Merged
merged 2 commits into from
Sep 1, 2024

Conversation

michaelfaith
Copy link
Contributor

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 of node:fs/promises.

image

Note: the removed test cases are exact duplicates of other tests. v9 fails tests when its determined to be an exact duplicate.

Closes: #978

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 Show resolved Hide resolved
__tests__/src/rules/no-static-element-interactions-test.js Outdated Show resolved Hide resolved
package.json Outdated
"jest": "^24.9.0",
"jest": "^29.7.0",
Copy link
Member

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.

Copy link
Contributor Author

@michaelfaith michaelfaith Aug 30, 2024

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?

Copy link
Member

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.

Copy link
Contributor Author

@michaelfaith michaelfaith Aug 30, 2024

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.

Copy link
Contributor Author

@michaelfaith michaelfaith Aug 31, 2024

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.

@michaelfaith michaelfaith force-pushed the feat/eslint-v9-support branch 8 times, most recently from 3db1f8c to 4f21b85 Compare August 31, 2024 12:46
Copy link

socket-security bot commented Aug 31, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@eslint/js@9.9.1 None 0 14.2 kB eslintbot
npm/core-js@3.38.1 None 0 1.24 MB zloirock
npm/eslint@9.9.1 environment Transitive: eval, filesystem, shell, unsafe +88 9.91 MB eslintbot
npm/globals@15.9.0 None 0 174 kB sindresorhus

View full report↗︎

@michaelfaith michaelfaith force-pushed the feat/eslint-v9-support branch 2 times, most recently from f99300c to 1231f61 Compare August 31, 2024 19:20
Copy link

codecov bot commented Aug 31, 2024

Codecov Report

Attention: Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.

Project coverage is 98.73%. Comparing base (a08fbcc) to head (1231f61).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
__tests__/__util__/parserOptionsMapper.js 87.50% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

__tests__/__util__/nodeReexports/assert.js Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
@michaelfaith michaelfaith force-pushed the feat/eslint-v9-support branch 3 times, most recently from f8e70cd to 903bca2 Compare September 1, 2024 17:13
@ljharb ljharb changed the title build: update to eslint v9 [New] add eslint 9 support Sep 1, 2024
Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good!

@ljharb ljharb mentioned this pull request Sep 1, 2024
13 tasks
@ljharb ljharb merged commit deac4fd into jsx-eslint:main Sep 1, 2024
105 checks passed
@michaelfaith michaelfaith deleted the feat/eslint-v9-support branch September 1, 2024 22:42
@iamtomcat
Copy link

When is this going out? Currently just using it from the repository directly.

@ljharb
Copy link
Member

ljharb commented Sep 4, 2024

@iamtomcat i'm not sure how you'd do that in a practical sense, since we have a build process. It's only been 2 days - I'd suggest not using it at all until it's published.

@iamtomcat
Copy link

Hey @ljharb I appreciate you getting the change out, I wasn't trying to rush you, just wanted to get a time frame was all.

Thanks again.

@ljharb
Copy link
Member

ljharb commented Sep 4, 2024

it's now released; v6.10.0.

@ruiaraujo012
Copy link

ruiaraujo012 commented Sep 12, 2024

@ljharb I think something is missing, there's no v6.10.0 release, there is a tag but not a release.

@ljharb
Copy link
Member

ljharb commented Sep 12, 2024

oh thanks, i always forget github releases (which don't matter; only npm matters)

@ruiaraujo012
Copy link

Oh, you're right, I didn't check npm 🙈 sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for ESLint 9
5 participants