Skip to content

Commit 8ae13d2

Browse files
brunomendolaclaude
andcommitted
Bump eslint to 10 and @eslint/js to 10, migrating the lint stack
Closes the Dependabot updates for eslint 9.39.4 -> 10.8.1 (#172) and @eslint/js 9.39.4 -> 10.0.1 (#114), which failed at `npm ci` with ERESOLVE because several plugins still cap eslint at ^9. Breaking changes handled: - eslint-plugin-import -> eslint-plugin-import-x. eslint-plugin-import 2.32.0 is the latest release and peers on eslint <=^9; import-x is the maintained fork that supports eslint 10. Rules and settings renamed from `import/*` to `import-x/*`. - eslint-plugin-react -> @eslint-react/eslint-plugin. eslint-plugin-react 7.37.5 does not merely have a stale peer range: under eslint 10 it throws "contextOrFilename.getFilename is not a function" on the first React rule, because eslint 10 removed the deprecated context methods. @eslint-react is the ESLint 10 compatible replacement. * `react/no-array-index-key` disable comments renamed to `@eslint-react/no-array-index-key`. * The `react/destructuring-assignment` disable comment is dropped; the rule has no @eslint-react equivalent. * `static-components`, `set-state-in-effect` and `no-use-context` are turned off: they are new rules with no eslint-plugin-react counterpart, so leaving them on would not be a like-for-like migration. Worth triaging in a follow-up. * @eslint-react/no-missing-key found a real bug in ArrayInput: the mapped element was a keyless `<>` with the key on the inner <Input>. Now a keyed <React.Fragment>. - overrides for eslint-plugin-jsx-a11y and eslint-plugin-import. jsx-a11y 6.10.2 peers on eslint <=^9 but works fine under 10, so its peer is pinned to the root eslint. eslint-plugin-import is no longer a direct dependency but is still pulled in as an optional peer of eslint-import-resolver-typescript, where its eslint <=^9 peer would otherwise re-break `npm ci`. `npm ci`, `npm run build`, `npm test` and `npm run lint` all pass; lint is left with the same 8 pre-existing errors as before the migration. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 5e83453 commit 8ae13d2

7 files changed

Lines changed: 633 additions & 430 deletions

File tree

‎eslint.config.mjs‎

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import js from "@eslint/js";
22
import tseslint from "typescript-eslint";
3-
import react from "eslint-plugin-react";
3+
import eslintReact from "@eslint-react/eslint-plugin";
44
import reactHooks from "eslint-plugin-react-hooks";
55
import jsxA11y from "eslint-plugin-jsx-a11y";
6-
import importPlugin from "eslint-plugin-import";
6+
import importX from "eslint-plugin-import-x";
77
import prettier from "eslint-plugin-prettier/recommended";
88
import globals from "globals";
99

@@ -19,9 +19,13 @@ export default tseslint.config(
1919
// TypeScript-ESLint recommended rules
2020
...tseslint.configs.recommended,
2121

22-
// React plugin
23-
react.configs.flat.recommended,
24-
react.configs.flat["jsx-runtime"],
22+
// React plugin (@eslint-react: eslint-plugin-react has no ESLint 10 support)
23+
{
24+
files: ["**/*.{js,jsx,ts,tsx}"],
25+
extends: [eslintReact.configs.recommended],
26+
},
27+
// Let eslint-plugin-react-hooks own the hooks rules
28+
eslintReact.configs["disable-conflict-eslint-plugin-react-hooks"],
2529

2630
// React Hooks (classic rules only — not the React Compiler preset)
2731
{
@@ -37,8 +41,8 @@ export default tseslint.config(
3741
// JSX Accessibility
3842
jsxA11y.flatConfigs.recommended,
3943

40-
// Import plugin
41-
importPlugin.flatConfigs.recommended,
44+
// Import plugin (eslint-plugin-import-x: the maintained fork with ESLint 10 support)
45+
importX.flatConfigs.recommended,
4246

4347
// Prettier (must be last preset to override conflicting rules)
4448
prettier,
@@ -57,10 +61,7 @@ export default tseslint.config(
5761
},
5862
},
5963
settings: {
60-
react: {
61-
version: "detect",
62-
},
63-
"import/resolver": {
64+
"import-x/resolver": {
6465
typescript: true,
6566
node: true,
6667
},
@@ -72,27 +73,27 @@ export default tseslint.config(
7273
files: ["**/*.{js,ts,tsx}"],
7374
rules: {
7475
"prettier/prettier": "warn",
75-
"react/jsx-props-no-spreading": "off",
7676
"no-nested-ternary": "off",
7777
"dot-notation": "off",
78-
"react/require-default-props": "off",
7978
"@typescript-eslint/ban-ts-comment": "warn",
8079
"jsx-a11y/click-events-have-key-events": "off",
8180
"jsx-a11y/no-static-element-interactions": "off",
82-
"react/function-component-definition": "off",
83-
"import/no-extraneous-dependencies": [
81+
"import-x/no-extraneous-dependencies": [
8482
"error",
8583
{
8684
devDependencies: true,
8785
optionalDependencies: true,
8886
peerDependencies: true,
8987
},
9088
],
91-
"react/no-unknown-property": ["error", { ignore: ["css"] }],
92-
"react/prop-types": "off",
9389
"default-param-last": "off",
94-
"import/export": "off",
95-
"import/prefer-default-export": "off",
90+
// Rules @eslint-react adds that eslint-plugin-react had no equivalent
91+
// for. Kept off so this migration is lint-neutral; triage separately.
92+
"@eslint-react/static-components": "off",
93+
"@eslint-react/set-state-in-effect": "off",
94+
"@eslint-react/no-use-context": "off",
95+
"import-x/export": "off",
96+
"import-x/prefer-default-export": "off",
9697
},
9798
},
9899
);

0 commit comments

Comments
 (0)