fix: complete ESLint 10 compatibility - #4022
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
f57523f to
25d08f4
Compare
Use isSpaceBetween when isSpaceBetweenTokens is unavailable, while preserving legacy JSXText whitespace behavior for older ESLint versions.
ESLint 10 rejects output and errors properties on valid test cases. These properties were ignored by older RuleTester versions.
Exclude Node 18, 19, 21, and 23 for ESLint 10, properly quoting node versions to avoid type mismatch in GitHub Actions matrix exclusions. Dynamically remove eslint-doc-generator before installing eslint 9+ to prevent EBADENGINE failures due to commander@14 requiring Node >=20. Format CHANGELOG.md to place removed support under a ### Breaking heading as per v7.0.0 conventions.
25d08f4 to
355177c
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4022 +/- ##
==========================================
+ Coverage 97.60% 97.73% +0.12%
==========================================
Files 137 137
Lines 10188 10189 +1
Branches 3797 3792 -5
==========================================
+ Hits 9944 9958 +14
+ Misses 244 231 -13 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Approved |
|
@ljharb I think this is over to you when you get a chance. |
|
Adding independent validation ahead of maintainer review: Behavioral parity on a production Next.js 16 / React 19 / TypeScript app Result: with this branch, ESLint 10.8.1 output is identical to the ESLint 9.39.4 baseline — on both the app's real Since most reports of the ESLint 10 crash come through Setup: Next.js 16.3.0 / React 19.2.8 / TypeScript strict, flat config via Details:
Caveats: one codebase; TS-only sources; React 19; rules with zero findings in both runs are smoke-tested but not behaviorally compared; |
ESLint 10 casse toutes les règles react/* : eslint-plugin-react (peer
« ^9.7 », tiré transitivement par eslint-config-next) appelle encore
context.getFilename(), retiré en ESLint 10. Le job frontend sortait en
code 2 dès le premier fichier :
TypeError: Error while loading rule 'react/display-name':
contextOrFilename.getFilename is not a function
Aucune version publiée ne corrige : eslint-plugin-react s'arrête à
7.37.5 et eslint-config-next 16.3.1 dépend toujours de « ^7.37.0 ». Le
correctif amont (jsx-eslint/eslint-plugin-react#4022) est encore ouvert.
Cette PR annule donc son propre bump et pose l'ignore à la place, pour
que Dependabot cesse de reproposer une montée non installable.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ESLint 10 casse toutes les règles react/* : eslint-plugin-react (peer
« ^9.7 », tiré transitivement par eslint-config-next) appelle encore
context.getFilename(), retiré en ESLint 10. Le job frontend sortait en
code 2 dès le premier fichier :
TypeError: Error while loading rule 'react/display-name':
contextOrFilename.getFilename is not a function
Aucune version publiée ne corrige : eslint-plugin-react s'arrête à
7.37.5 et eslint-config-next 16.3.1 dépend toujours de « ^7.37.0 ». Le
correctif amont (jsx-eslint/eslint-plugin-react#4022) est encore ouvert.
Cette PR annule donc son propre bump et pose l'ignore à la place, pour
que Dependabot cesse de reproposer une montée non installable.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ESLint 10 casse toutes les règles react/* : eslint-plugin-react (peer
« ^9.7 », tiré transitivement par eslint-config-next) appelle encore
context.getFilename(), retiré en ESLint 10. Le job frontend sortait en
code 2 dès le premier fichier :
TypeError: Error while loading rule 'react/display-name':
contextOrFilename.getFilename is not a function
Aucune version publiée ne corrige : eslint-plugin-react s'arrête à
7.37.5 et eslint-config-next 16.3.1 dépend toujours de « ^7.37.0 ». Le
correctif amont (jsx-eslint/eslint-plugin-react#4022) est encore ouvert.
Cette PR pose donc l'ignore, pour que Dependabot cesse de reproposer une
montée non installable.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
eslint-plugin-react@7.37.5 is the only package in webapp/ that rejects ESLint 10 (peer `eslint ... || ^9.7`), so the bump in the parent commit cannot install. The peer range is accurate rather than conservative: with an override forcing the install, the plugin throws on the first file -- `lib/util/version.js` calls `context.getFilename()`, removed in ESLint 10. Upstream has had no release since 7.37.5 (2025-04-03) and the ESLint 10 compatibility PR (jsx-eslint/eslint-plugin-react#4022) is still open. @eslint-react/eslint-plugin is maintained, ESLint-10 clean, and needs no type-aware linting (its `recommended` and `recommended-typescript` presets are identical). eslint-plugin-react-hooks stays the authority for the dozen rules the two plugins both implement. Three findings the new preset surfaced were worth acting on rather than silencing: `<SettingsContext.Provider>` and `useContext` are the pre-React-19 spellings, and a ref was not named for what it is. This is a deliberate lint-policy change, not part of the version bump, hence its own commit. Signed-off-by: Jimisola Laursen <jimisola@jimisola.com>
eslint-plugin-react@7.37.5 is the only package in webapp/ that rejects ESLint 10 (peer `eslint ... || ^9.7`), so the bump in the parent commit cannot install. The peer range is accurate rather than conservative: with an override forcing the install, the plugin throws on the first file -- `lib/util/version.js` calls `context.getFilename()`, removed in ESLint 10. Upstream has had no release since 7.37.5 (2025-04-03) and the ESLint 10 compatibility PR (jsx-eslint/eslint-plugin-react#4022) is still open. @eslint-react/eslint-plugin is maintained, ESLint-10 clean, and needs no type-aware linting (its `recommended` and `recommended-typescript` presets are identical). eslint-plugin-react-hooks stays the authority for the dozen rules the two plugins both implement. Three findings the new preset surfaced were worth acting on rather than silencing: `<SettingsContext.Provider>` and `useContext` are the pre-React-19 spellings, and a ref was not named for what it is. This is a deliberate lint-policy change, not part of the version bump, hence its own commit. Signed-off-by: Jimisola Laursen <jimisola@jimisola.com>
* chore(npm): update eslint monorepo to v10 * fix(webapp): replace eslint-plugin-react with @eslint-react eslint-plugin-react@7.37.5 is the only package in webapp/ that rejects ESLint 10 (peer `eslint ... || ^9.7`), so the bump in the parent commit cannot install. The peer range is accurate rather than conservative: with an override forcing the install, the plugin throws on the first file -- `lib/util/version.js` calls `context.getFilename()`, removed in ESLint 10. Upstream has had no release since 7.37.5 (2025-04-03) and the ESLint 10 compatibility PR (jsx-eslint/eslint-plugin-react#4022) is still open. @eslint-react/eslint-plugin is maintained, ESLint-10 clean, and needs no type-aware linting (its `recommended` and `recommended-typescript` presets are identical). eslint-plugin-react-hooks stays the authority for the dozen rules the two plugins both implement. Three findings the new preset surfaced were worth acting on rather than silencing: `<SettingsContext.Provider>` and `useContext` are the pre-React-19 spellings, and a ref was not named for what it is. This is a deliberate lint-policy change, not part of the version bump, hence its own commit. Signed-off-by: Jimisola Laursen <jimisola@jimisola.com> --------- Signed-off-by: Jimisola Laursen <jimisola@jimisola.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jimisola Laursen <jimisola@jimisola.com>
* chore(npm): update eslint monorepo to v10 * fix(webapp): replace eslint-plugin-react with @eslint-react eslint-plugin-react@7.37.5 is the only package in webapp/ that rejects ESLint 10 (peer `eslint ... || ^9.7`), so the bump in the parent commit cannot install. The peer range is accurate rather than conservative: with an override forcing the install, the plugin throws on the first file -- `lib/util/version.js` calls `context.getFilename()`, removed in ESLint 10. Upstream has had no release since 7.37.5 (2025-04-03) and the ESLint 10 compatibility PR (jsx-eslint/eslint-plugin-react#4022) is still open. @eslint-react/eslint-plugin is maintained, ESLint-10 clean, and needs no type-aware linting (its `recommended` and `recommended-typescript` presets are identical). eslint-plugin-react-hooks stays the authority for the dozen rules the two plugins both implement. Three findings the new preset surfaced were worth acting on rather than silencing: `<SettingsContext.Provider>` and `useContext` are the pre-React-19 spellings, and a ref was not named for what it is. This is a deliberate lint-policy change, not part of the version bump, hence its own commit. Signed-off-by: Jimisola Laursen <jimisola@jimisola.com> --------- Signed-off-by: Jimisola Laursen <jimisola@jimisola.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jimisola Laursen <jimisola@jimisola.com>
This PR brings ESLint v10 compatibility to
eslint-plugin-react.It consolidates and builds upon the work of several contributors across the history of #3979 to create a fully-green patch branch that resolves all unit test failures and CI matrix issues under ESLint 10.
History & Summary of Integrated Changes
RuleContext &
getFilenameAPI adaptations (by @ledsun & @tylermumford):context.getFilename()calls witheslintUtil.getFilename(context).RuleTester
type:property stripping (by @captaindonald in [Tests] drop ESLint-10-incompatible 'type:' property from RuleTester error assertions #4006):tests/helpers/ruleTester.jsto striptype:from expected error objects when running on ESLint >= 10.Matrix & Spacing API updates (from @Trott's
patch-1branch):typescript@5installation to ESLint 9+ test matrices so modern TS parsers don't fail against old matrix TypeScript versions.isSpaceBetweenFallback: AddedeslintUtil.isSpaceBetweenhelper inlib/util/eslint.jsreplacing the removedsourceCode.isSpaceBetweenTokens.outputanderrorsfields from valid test cases injsx-indent-props,jsx-indent,jsx-no-bind, andrequire-optimization.Breaking Changes
SourceCodeAPIs required by these changes.Fixes & AST Migration:
lib/util/componentUtil.js): Added a fallback checkingsourceCode.getCommentsBefore(node)when the removedsourceCode.getJSDocCommentis unavailable on ESLint 10. This fixes JSDoc@extends React.Componentdetection forno-typosandprop-types.sourceCodeequivalents to resolve AST fallback failures on newer versions.tests/helpers/parsers.js): Passed{ includePrerelease: true }tosemver.satisfiesso canary/prerelease versions of@typescript-eslint/parserare matched correctly. Fixes failures injsx-uses-react.no-undefJSX Comment Override (tests/lib/rules/jsx-no-undef.js): Added a test code map replacing/*eslint no-undef:1*/with/*eslint no-undef:0*/on ESLint >= 10, preventing ESLint 10's native JSXno-undeftracking from producing duplicate errors.lib/util/version.js): AddedENOENThandling alongsideENOTDIRinresolveBasedirfor virtual file paths on Windows.typescriptandeslint-doc-generatorfromdevDependenciesdynamically during test matrix runs, bumpedls-enginesvalidation to Node >= 14, and properly excluded ESLint 10 from running on unsupported Node versions (18, 19, 21, 23).scripts/audit.js.Related Issues
Dependency Overrides for ESLint 10
To pass CI on modern npm versions (which strictly enforce peer dependencies), temporary "overrides" have been added to package.json for several dev dependencies that do not yet officially support ESLint 10. These overrides can be removed once the following upstream issues are resolved: