Repository navigation
Conversation
ljharb
left a comment
There was a problem hiding this comment.
we'll need regression tests - it might be as simple as adding eslint 10 to the GHA matrix.
f987ffa to
a7b967b
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3979 +/- ##
==========================================
- Coverage 97.71% 97.56% -0.15%
==========================================
Files 137 134 -3
Lines 10188 10177 -11
Branches 3797 3797
==========================================
- Hits 9955 9929 -26
- Misses 233 248 +15 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
6a95ab9 to
13c7805
Compare
|
@ledsun do you have time to address the failing checks. I'm looking at updating to eslint 10 and we're using the eslint-plugin-react |
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as off-topic.
This comment was marked as off-topic.
|
@ljharb The Next.js team is waiting for this plugin to be compatible with ESLint 10 so they can update |
|
Some news here? This PR also blocks the ESLint 10 usage for Nx workspaces |
ljharb
left a comment
There was a problem hiding this comment.
Thanks for this! The workflow and types changes look close, but adding ^10 to peerDependencies isn't safe yet: running the full test suite against eslint 10.13 (node 20, 22, and 24) gives ~833 failures:
- ~800 runtime crashes: eslint 10 removed
SourceCode#isSpaceBetweenTokens, whichjsx-curly-spacing,jsx-tag-spacing,jsx-one-expression-per-line,jsx-space-before-closing, andjsx-equals-spacingall call, so those rules throw aTypeErrorfor eslint 10 users. This needs a helper inlib/util/eslint.js; note thatisSpaceBetweenisn't a drop-in replacement, sinceisSpaceBetweenTokensalso counts whitespace inside JSXText (whichjsx-one-expression-per-linerelies on), andisSpaceBetweendoesn't exist before eslint 6.7. @extendsJSDoc detection:no-typosandprop-typesno longer recognize/** @extends React.Component */, sincegetJSDocCommentis gone.- stricter RuleTester: valid cases that have
outputorerrorsare now rejected (jsx-indent,jsx-indent-props,jsx-no-bind,require-optimization) - those are test bugs that can just be cleaned up. jsx-no-undef: the tests' inline/*eslint no-undef:1*/now also produces a coreno-undeferror.sort-prop-types: tests that hardcode the legacytypescript-eslint-parserbreak with thetypescript@5this installs.
The eslint 10 CI jobs this PR adds would be red until those are fixed.
| }, | ||
| "peerDependencies": { | ||
| "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7" | ||
| "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7 || ^10" |
There was a problem hiding this comment.
This shouldn't be added until the runtime incompatibilities (see the review summary) are fixed; otherwise eslint 10 users will hit crashes in several rules.
| node-version: ${{ matrix.node-version }} | ||
| after_install: | | ||
| npm install --no-save "eslint@${{ matrix.eslint }}" "@typescript-eslint/parser@${{ matrix.typescript-eslint == 8 && 8.17 || matrix.typescript-eslint }}" "babel-eslint@${{ matrix.babel-eslint }}" | ||
| npm install --no-save "eslint@${{ matrix.eslint }}" "@typescript-eslint/parser@${{ matrix.eslint == 10 && 'canary' || (matrix.typescript-eslint == 8 && 8.17 || matrix.typescript-eslint) }}" "babel-eslint@${{ matrix.babel-eslint }}" ${{ matrix.eslint == 10 && '"typescript@5"' || '' }} |
There was a problem hiding this comment.
canary is unpinned and changes from run to run; stable @typescript-eslint/parser 8 (8.72+) already supports eslint 10 in its peer deps, so this can use 8 instead.
There was a problem hiding this comment.
Addressed in #4022 (3027ec92): removed unpinned 'canary' and pinned to @typescript-eslint/parser@8.17 (matching ESLint 9, to avoid the @typescript-eslint/parser >= 8.18 breaking change noted in 2c0b10cb / typescript-eslint/typescript-eslint#10480), with ESLint 10 peer dependency resolution handled via package.json overrides and --legacy-peer-deps.
| - eslint: 10 | ||
| node-version: 18 | ||
| - eslint: 10 | ||
| node-version: 19 |
There was a problem hiding this comment.
eslint 10's engines are ^20.19.0 || ^22.13.0 || >=24, so node 21 and 23 need to be excluded too (and the comment above should be updated to match).
| - eslint: 10 | ||
| node-version: 19 | ||
| - eslint: 10 | ||
| babel-eslint: 8 |
There was a problem hiding this comment.
Why is babel-eslint 8 excluded? If it's genuinely incompatible, a comment explaining that would help.
There was a problem hiding this comment.
Addressed in #4022 (3b453326): removed the eslint: 10 / babel-eslint: 8 exclusion. It had only been added earlier in #3979 to stay under the 256-job matrix limit before the workflow was split into eslint-8-.yml and eslint-9+.yml, and babel-eslint: 8 works on ESLint 10 via the scopeManager.addGlobals shim in tests/helpers/ruleTester.js.
| * @returns {import('eslint').Rule.RuleModule} | ||
| */ | ||
| module.exports = function makeNoMethodSetStateRule(methodName, shouldCheckUnsafeCb) { | ||
| const docs = { |
There was a problem hiding this comment.
This is needed (without it, eslint 10's types fail with TS2353 on category), but it looks like a no-op refactor at a glance - could you add a comment explaining why docs is hoisted, so nobody inlines it back?
|
In reply to @ljharb's October 22 review summary (
|
This PR follows up on the feedback in the comments of #3972 and incorporates the requested changes.
I think this PR will fix #3977.