できない.dev

ESLint を 9 から 10 に上げると動かなくなること

ESLint を 9 から 10 に上げると、ESLINT_USE_FLAT_CONFIG=false の .eslintrc が読めなくなる。
eslint-plugin-react は @eslint/js@10 と一緒に入らず、入れても React の版が detect だと落ちる。
打ち比べた 7 つの変更点と直し方をまとめる。

公開: 更新:

eslint@9 と @eslint/js@9 を入れたプロジェクトと、同じファイルのまま 10 に上げたプロジェクトを並べ、同じコマンドを打ち比べた。
各節の出力は「v9 では」「v10 に上げると」「v10 で直すと」の 3 段で並ぶ。

7 つのうち 4 つは止まり、止まり方は 3 通りある。
.eslintrc と古い jiti は、lint を始める前に終了コード 2 で止まる。
eslint-plugin-react は、@eslint/js 10 と一緒に入れる npm install が止まる。
eslint-env のコメントは lint のエラーとして 1 件数えられ、終了コード 1 で終わる。
残りの 3 つ(設定ファイルの探し方・js.configs.recommended のルール・JSX の扱い)は止まらずに、同じコードでも報告が変わる。
ただし、9 で設定ファイルの探し方を先取りするフラグを付けていると、10 ではそのフラグで止まる。

10 がサポートする Node.js は 20.19.0 以上・22.13.0 以上・24 以上で、21 と 23 はサポートの対象から外れた(公式の移行ガイドによる)。
ここでは Node.js 24 だけで打ったので、古い Node.js での出方は確かめていない。

次の変更も、ここでは打っていない。
どれも公式の移行ガイドに載っている。

  • 公式の codemod npx codemod @eslint/v9-to-v10 は、古い環境変数と CLI のフラグを消す。
    自作ルールで消えたメソッド、RuleTester の書き方、Linter と ESLint の API の呼び方も書き換える。
  • 自作のルールやプラグイン、ESLint を組み込んで使うプログラム向けの変更(RuleTester・fixer・LintMessage・ScopeManager、FlatESLint と LegacyESLint の削除など)は扱っていない。
  • @eslint/eslintrc の FlatCompat と @eslint/js 10 を一緒に使うなら、@eslint/eslintrc を最新に上げる。
  • no-shadow-restricted-names が、既定で globalThis も報告するようになった。
  • radix の非推奨のオプション、func-names と no-invalid-regexp のオプションの検査、glob の POSIX 文字クラス、stylish の色の出し方も変わった。

.eslintrc と ESLINT_USE_FLAT_CONFIG=false が使えなくなった

9 は既定で eslint.config.* を探し、見つからなければ止まった。
.eslintrc.* のまま使い続けるには、環境変数 ESLINT_USE_FLAT_CONFIG=false で古い形式に切り替える必要があった。
10 では古い形式そのものが無くなり、この変数を付けても eslint.config.* しか探さない。
.eslintignore も読まれない。

v9 では

$ cat .eslintrc.json
{
  "root": true,
  "env": { "node": true, "es2022": true },
  "extends": "eslint:recommended"
}
$ cat .eslintignore
dist/
$ ESLINT_USE_FLAT_CONFIG=false npx eslint .
(node:150) ESLintRCWarning: You are using an eslintrc configuration file, which is deprecated and support will be removed in v10.0.0. Please migrate to an eslint.config.js file. See https://eslint.org/docs/latest/use/configure/migration-guide for details. An eslintrc configuration file is used because you have the ESLINT_USE_FLAT_CONFIG environment variable set to false. If you want to use an eslint.config.js file, remove the environment variable. If you want to find the location of the eslintrc configuration file, use the --debug flag.
(Use `node --trace-warnings ...` to show where the warning was created)
$ echo $?
0

v10 に上げると

$ npm install -D eslint@10
added 10 packages, removed 19 packages, and changed 15 packages in 627ms
$ echo $?
0
$ ESLINT_USE_FLAT_CONFIG=false npx eslint .
(node:182) ESLintIgnoreWarning: The ".eslintignore" file is no longer supported. Switch to using the "ignores" property in "eslint.config.js": https://eslint.org/docs/latest/use/configure/migration-guide#ignore-files
(Use `node --trace-warnings ...` to show where the warning was created)
 
Oops! Something went wrong! :(
 
ESLint: 10.14.0
 
ESLint couldn't find an eslint.config.* file.
 
From ESLint v9.0.0, the default configuration file is now eslint.config.*.
If you are using a .eslintrc.* file, please follow the migration guide
to update your configuration file to the new format:
 
https://eslint.org/docs/latest/use/configure/migration-guide
 
If you still have problems after following the migration guide, please stop by
https://eslint.org/chat/help to chat with the team.
$ echo $?
2

v10 で直すと

$ npx @eslint/migrate-config .eslintrc.json
npm warn exec The following package was not found and will be installed: @eslint/migrate-config@3.0.3
 
Migrating .eslintrc.json
Also importing your .eslintignore file
 
Wrote new config to ./eslint.config.mjs
 
You will need to install the following packages to use the new config:
- globals
- @eslint/js
- @eslint/eslintrc
 
You can install them using the following command:
 
npm install globals @eslint/js @eslint/eslintrc -D
$ echo $?
0
$ cat eslint.config.mjs
import { defineConfig, globalIgnores } from "eslint/config";
import globals from "globals";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
 
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
    baseDirectory: __dirname,
    recommendedConfig: js.configs.recommended,
    allConfig: js.configs.all
});
 
export default defineConfig([globalIgnores(["**/dist/"]), {
    extends: compat.extends("eslint:recommended"),
 
    languageOptions: {
        globals: {
            ...globals.node,
        },
    },
}]);
$ npm install -D globals @eslint/js @eslint/eslintrc
added 17 packages in 348ms
$ echo $?
0
$ rm .eslintrc.json .eslintignore
$ npx eslint .
$ echo $?
0

9 は lint を通したうえで、10 で古い形式が無くなるという ESLintRCWarning を出していた。
10 では同じコマンドが終了コード 2 で止まる。
シェルの設定や CI に ESLINT_USE_FLAT_CONFIG=false を書いているなら、それも消す。

@eslint/migrate-config に .eslintrc.json を渡すと、eslint.config.mjs を書き出す。
env の node は globals.node に移り、.eslintignore の dist/ は globalIgnores(["**/dist/"]) に移った。
env の es2022 は書き出されなかった。
flat config では ecmaVersion の既定が "latest" で、その版の組み込みのグローバルも入るので、es2022 に当たる設定は書かなくてよい(ESLint の言語オプションのドキュメントによる)。
生成された設定は eslint:recommended を @eslint/eslintrc の FlatCompat で読むので、案内に出た 3 つのパッケージを入れる。
FlatCompat の部分は、ほかの節の設定のように js.configs.recommended を配列に並べる書き方に置き換えられる。

移したあとは .eslintrc.json と .eslintignore を消す。
「v10 に上げると」の段では、.eslintignore を読まないことを知らせる ESLintIgnoreWarning が出た。
設定ファイルがあって .eslintignore も残っている状態は、このページでは打っていない。

.eslintrc.js に関数や条件分岐を書いている場合、@eslint/migrate-config は評価した結果の値だけを移す(公式の設定の移行ガイド「Configuration Migration Guide」による)ので、生成された設定を読み直す。

@eslint/js 10 と eslint-plugin-react を一緒に npm install できなくなった

eslint-plugin-react の最新版 7.37.5 は、peerDependencies で対応する ESLint を ^9.7 までとしている。
一方で @eslint/js@10 は ESLint 10 を求める。
eslint と @eslint/js を一緒に 10 へ上げようとすると、npm が依存関係を解決できずに止まる。
eslint だけを 10 に上げたときの install は、このページでは打っていない。
overrides で入れたあとも、React の版を "detect" にした設定は lint の途中で落ちる。

v9 では

$ cat eslint.config.mjs
import js from "@eslint/js";
import react from "eslint-plugin-react";
import globals from "globals";
 
export default [
  js.configs.recommended,
  { files: ["**/*.jsx"], ...react.configs.flat.recommended },
  { files: ["**/*.jsx"], ...react.configs.flat["jsx-runtime"] },
  {
    languageOptions: { globals: globals.browser },
    settings: { react: { version: "detect" } },
  },
];
$ npx eslint src
/work/react/src/List.jsx
  1:24  error  'items' is missing in props validation      react/prop-types
  4:14  error  'items.map' is missing in props validation  react/prop-types
  5:9   error  Missing "key" prop for element in iterator  react/jsx-key
 
✖ 3 problems (3 errors, 0 warnings)
$ echo $?
1

v10 に上げると

$ npm install -D eslint@10 @eslint/js@10
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: react@1.0.0
npm error Found: @eslint/js@9.39.5
npm error node_modules/@eslint/js
npm error   @eslint/js@"9.39.5" from eslint@9.39.5
npm error   node_modules/eslint
npm error     peer eslint@"^6.0.0 || ^7.0.0 || >=8.0.0" from @eslint-community/eslint-utils@4.10.1
npm error     node_modules/@eslint-community/eslint-utils
npm error       @eslint-community/eslint-utils@"^4.8.0" from eslint@9.39.5
npm error     peer eslint@"^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7" from eslint-plugin-react@7.37.5
npm error     node_modules/eslint-plugin-react
npm error       dev eslint-plugin-react@"^7.37.5" from the root project
npm error     1 more (the root project)
npm error   dev @eslint/js@"10" from the root project
npm error
npm error Could not resolve dependency:
npm error dev @eslint/js@"10" from the root project
npm error
npm error Conflicting peer dependency: eslint@10.14.0
npm error node_modules/eslint
npm error   peerOptional eslint@"^10.0.0" from @eslint/js@10.0.1
npm error   node_modules/@eslint/js
npm error     dev @eslint/js@"10" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry this command with --force or --legacy-peer-deps to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /root/.npm/_logs/2026-11-08T03_36_00_378Z-eresolve-report.txt
npm error A complete log of this run can be found in: /root/.npm/_logs/2026-11-08T03_36_00_378Z-debug-0.log
$ echo $?
1
$ npm view eslint-plugin-react peerDependencies.eslint
^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7
$ npm view eslint-plugin-import peerDependencies.eslint
^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^9
$ npm view eslint-plugin-jsx-a11y peerDependencies.eslint
^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9

v10 で直すと

$ cat package.json
{
  "name": "react",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "type": "commonjs",
  "devDependencies": {
    "@eslint/js": "^9.39.5",
    "eslint": "^9.39.5",
    "eslint-plugin-react": "^7.37.5",
    "globals": "^17.14.0",
    "react": "^19.3.1"
  },
  "overrides": {
    "eslint-plugin-react": {
      "eslint": "$eslint"
    }
  }
}
$ npm install -D eslint@10 @eslint/js@10
added 16 packages, removed 17 packages, and changed 13 packages in 859ms
$ echo $?
0
$ npm ls eslint
react@1.0.0 /work/react
+-- @eslint/js@10.0.1
| `-- eslint@10.14.0 deduped
+-- eslint-plugin-react@7.37.5
| `-- eslint@10.14.0 deduped
`-- eslint@10.14.0
  `-- @eslint-community/eslint-utils@4.10.1
    `-- eslint@10.14.0 deduped
$ npx eslint src
Oops! Something went wrong! :(
 
ESLint: 10.14.0
 
TypeError: Error while loading rule 'react/display-name': contextOrFilename.getFilename is not a function
Occurred while linting /work/react/src/List.jsx
    at resolveBasedir (/work/react/node_modules/eslint-plugin-react/lib/util/version.js:31:100)
    at detectReactVersion (/work/react/node_modules/eslint-plugin-react/lib/util/version.js:85:19)
    at getReactVersionFromContext (/work/react/node_modules/eslint-plugin-react/lib/util/version.js:116:25)
    at testReactVersion (/work/react/node_modules/eslint-plugin-react/lib/util/version.js:181:28)
    at usedPropTypesInstructions (/work/react/node_modules/eslint-plugin-react/lib/util/usedPropTypes.js:307:36)
    at Components.componentRule (/work/react/node_modules/eslint-plugin-react/lib/util/Components.js:940:37)
    at createRuleListeners (/work/react/node_modules/eslint/lib/linter/linter.js:502:15)
    at /work/react/node_modules/eslint/lib/linter/linter.js:628:7
    at Array.forEach (<anonymous>)
    at runRules (/work/react/node_modules/eslint/lib/linter/linter.js:562:31)
$ echo $?
2
$ grep -n version eslint.config.mjs
11:    settings: { react: { version: "19.0" } },
$ npx eslint src
/work/react/src/List.jsx
  1:24  error  'items' is missing in props validation      react/prop-types
  4:14  error  'items.map' is missing in props validation  react/prop-types
  5:9   error  Missing "key" prop for element in iterator  react/jsx-key
 
✖ 3 problems (3 errors, 0 warnings)
$ echo $?
1

npm のエラーは @eslint/js を名指ししているが、ぶつかっている相手は eslint-plugin-react の ^9.7 である。
eslint-plugin-import と eslint-plugin-jsx-a11y の最新版も、範囲が ^9 で止まっている。

npm の overrides で、eslint-plugin-react が求める eslint をプロジェクトの eslint に合わせる。
"$eslint" は、package.json の devDependencies に書いた eslint の範囲を指す。
npm ls eslint を打つと、eslint-plugin-react の下の eslint も 10.14.0 に揃っている。

入れたあとも、React の版を "detect" にした設定は contextOrFilename.getFilename is not a function で落ちた。
eslint-plugin-react は "detect" のときに context.getFilename() を呼ぶが、このメソッドは 10 で消えた。
settings.react.version に "19.0" のように版を書くと、v9 と同じ 3 件のエラーが出て、プラグインのルールは動いた。

overrides は eslint-plugin-react に見せる eslint の版を置き換えるだけで、プラグインの中身は変わらない。
10 では context.getFilename() のほかに context.getSourceCode() なども消えた(公式の移行ガイドによる)ので、プラグインのほかのルールがこれらを呼べば同じように落ちる。

npm のエラーが勧める --legacy-peer-deps は、プロジェクトのすべてのパッケージで peer の検査を外してしまう。
このページでは使わず、overrides で eslint-plugin-react の分だけを外した。

eslint-env コメントがエラーになった

/* eslint-env node */ は、eslintrc 形式でファイルごとにグローバル変数を足すコメントだった。
flat config は 9 でもこのコメントを読まず、グローバル変数は設定ファイルの languageOptions.globals に書く。
9 は警告を出すだけだったが、10 ではエラーとして数え、終了コードが 1 になる。

v9 では

$ cat src/index.js
/* eslint-env node */
console.log(process.cwd());
$ npx eslint src
(node:484) ESLintEnvWarning: /* eslint-env */ comments are no longer recognized when linting with flat config and will be reported as errors as of v10.0.0. Replace them with /* global */ comments or define globals in your config file. See https://eslint.org/docs/latest/use/configure/migration-guide#eslint-env-configuration-comments for details. Found in /work/v9/eslint-env/src/index.js at line 1.
(Use `node --trace-warnings ...` to show where the warning was created)
$ echo $?
0

v10 に上げると

$ npx eslint src
/work/v10/eslint-env/src/index.js
  1:1  error  /* eslint-env */ comments are no longer supported
 
✖ 1 problem (1 error, 0 warnings)
$ echo $?
1

v10 で直すと

$ cat src/index.js
console.log(process.cwd());
$ npx eslint src
$ echo $?
0

設定ファイルに globals.node を書いてあれば、コメントを消すだけで済む。
テストのファイルだけ環境が違うなら、files でファイルを絞った設定を足し、その languageOptions.globals に globals.jest などを書く。
1 ファイルだけなら、/* global describe, it */ のようにコメントで変数の名前を並べてもよい。

eslint.config.ts が古い jiti で読めなくなった

ESLint は TypeScript で書いた設定ファイル(eslint.config.ts)を、jiti というパッケージで読む。
10 は jiti 2.2.0 より前の版を受け付けず、2.1.2 のままだと lint を始める前に止まる。

v9 では

$ cat eslint.config.ts
import js from "@eslint/js";
 
export default [js.configs.recommended];
$ npm ls jiti
jiti9@1.0.0 /work/jiti9
+-- eslint@9.39.5
| `-- jiti@2.1.2 deduped
`-- jiti@2.1.2
$ npx eslint src
$ echo $?
0

v10 に上げると

$ npx eslint src
Oops! Something went wrong! :(
 
ESLint: 10.14.0
 
Error: You are using an outdated version of the 'jiti' library. Please update to the latest version of 'jiti' to ensure compatibility and access to the latest features.
    at loadTypeScriptConfigFileWithJiti (/work/jiti10/node_modules/eslint/lib/config/config-loader.js:155:9)
    at async loadConfigFile (/work/jiti10/node_modules/eslint/lib/config/config-loader.js:265:11)
    at async ConfigLoader.calculateConfigArray (/work/jiti10/node_modules/eslint/lib/config/config-loader.js:594:23)
    at async #calculateConfigArray (/work/jiti10/node_modules/eslint/lib/config/config-loader.js:369:19)
    at async entryFilter (/work/jiti10/node_modules/eslint/lib/eslint/eslint-helpers.js:324:5)
    at async NodeHfs.<anonymous> (file:///work/jiti10/node_modules/@humanfs/core/src/hfs.js:574:24)
    at async NodeHfs.walk (file:///work/jiti10/node_modules/@humanfs/core/src/hfs.js:614:3)
    at async globSearch (/work/jiti10/node_modules/eslint/lib/eslint/eslint-helpers.js:366:20)
    at async Promise.allSettled (index 0)
    at async globMultiSearch (/work/jiti10/node_modules/eslint/lib/eslint/eslint-helpers.js:457:18)
$ echo $?
2

v10 で直すと

$ npm install -D jiti@latest
changed 1 package in 420ms
$ echo $?
0
$ npm ls jiti
jiti10@1.0.0 /work/jiti10
+-- eslint@10.14.0
| `-- jiti@2.7.0 deduped
`-- jiti@2.7.0
$ npx eslint src
$ echo $?
0

jiti を上げれば直る。
エラーの文には必要な版が出ないが、公式の移行ガイドでは 2.2.0 以上としている。

設定ファイルを lint するファイルの場所から探すようになった

9 は eslint.config.* を、コマンドを打ったディレクトリから上へ探し、見つけた 1 つをすべてのファイルに使った。
10 は lint するファイルごとに、そのファイルのディレクトリから上へ探す。
9 で --flag v10_config_lookup_from_file を付けたときの探し方が既定になった。
ルートとパッケージの両方に eslint.config.mjs があるモノレポでは、同じコマンドでも使う設定が変わる。

v9 では

$ cat eslint.config.mjs
import js from "@eslint/js";
import globals from "globals";
 
export default [
  js.configs.recommended,
  { languageOptions: { globals: globals.node } },
  { rules: { "no-console": "error" } },
];
$ cat packages/web/eslint.config.mjs
import js from "@eslint/js";
import globals from "globals";
 
export default [
  js.configs.recommended,
  { languageOptions: { globals: globals.browser } },
  { rules: { "prefer-const": "error" } },
];
$ npx eslint packages/web
/work/v9/config-lookup/packages/web/src/index.js
  2:1  error  Unexpected console statement  no-console
 
✖ 1 problem (1 error, 0 warnings)
$ echo $?
1
$ npx eslint --flag v10_config_lookup_from_file packages/web
/work/v9/config-lookup/packages/web/src/index.js
  1:5  error  'count' is never reassigned. Use 'const' instead  prefer-const
 
✖ 1 problem (1 error, 0 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option.
$ echo $?
1

v10 に上げると

$ npx eslint packages/web
/work/v10/config-lookup/packages/web/src/index.js
  1:5  error  'count' is never reassigned. Use 'const' instead  prefer-const
 
✖ 1 problem (1 error, 0 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option.
$ echo $?
1
$ npx eslint --flag v10_config_lookup_from_file packages/web
Oops! Something went wrong! :(
 
ESLint: 10.14.0
 
Error: Unknown flag 'v10_config_lookup_from_file'.
    at /work/v10/node_modules/eslint/lib/linter/linter.js:817:11
    at Array.forEach (<anonymous>)
    at new Linter (/work/v10/node_modules/eslint/lib/linter/linter.js:795:9)
    at createLinter (/work/v10/node_modules/eslint/lib/eslint/eslint-helpers.js:1344:9)
    at new ESLint (/work/v10/node_modules/eslint/lib/eslint/eslint.js:728:18)
    at Object.execute (/work/v10/node_modules/eslint/lib/cli.js:377:13)
    at async main (/work/v10/node_modules/eslint/bin/eslint.js:191:19)
$ echo $?
2

v10 で直すと

$ npx eslint -c eslint.config.mjs packages/web
/work/v10/config-lookup/packages/web/src/index.js
  2:1  error  Unexpected console statement  no-console
 
✖ 1 problem (1 error, 0 warnings)
$ echo $?
1

ルートで打った npx eslint packages/web は、9 ではルートの設定(no-console)を使い、10 では packages/web の設定(prefer-const)を使った。

フラグは 10 で無くなり、付けたままだと Unknown flag で止まる。
package.json のスクリプトや CI に書いていれば消す。
公式の移行ガイドは、環境変数 ESLINT_FLAGS と、API の new ESLint()・new Linter() に渡す flags からも消すよう書いている。

ルートの設定ですべてを lint したいなら、-c で設定ファイルを指定する。
-c を付けると、ファイルの場所にかかわらず指定した 1 つだけを使う。
パッケージごとの設定を使う 10 の動きに合わせるなら、ルートの設定にあったルールをパッケージの設定にも足す。

js.configs.recommended に 3 つのルールが増えた

@eslint/js 10 の js.configs.recommended に、no-unassigned-vars・no-useless-assignment・preserve-caught-error の 3 つが入った。
ルールの一覧は @eslint/js の版で決まり、eslint だけを 10 に上げても増えない。
@eslint/js を 10 に上げたところで、9 で通っていたコードがエラーになる。

v9 では

$ cat src/config.js
import { readFileSync } from "node:fs";
 
export function loadConfig(path) {
  let timeout;
  let raw = "";
  raw = readFileSync(path, "utf8");
  try {
    return { timeout, ...JSON.parse(raw) };
  } catch (err) {
    throw new Error(`設定ファイルを読めない: ${path}: ${err.message}`);
  }
}
$ npx eslint src
$ echo $?
0

v10 に上げると

$ npm install -D eslint@10
added 10 packages, removed 18 packages, and changed 15 packages in 577ms
$ echo $?
0
$ npx eslint src
$ echo $?
0
$ npm install -D @eslint/js@10
changed 1 package in 229ms
$ echo $?
0
$ npx eslint src
/work/recommended/src/config.js
   4:7  error  'timeout' is always 'undefined' because it's never assigned       no-unassigned-vars
   5:7  error  The value assigned to 'raw' is not used in subsequent statements  no-useless-assignment
  10:5  error  There is no `cause` attached to the symptom error being thrown    preserve-caught-error
 
✖ 3 problems (3 errors, 0 warnings)
$ echo $?
1

v10 で直すと

$ cat src/config.js
import { readFileSync } from "node:fs";
 
export function loadConfig(path) {
  const raw = readFileSync(path, "utf8");
  try {
    return { timeout: 30, ...JSON.parse(raw) };
  } catch (err) {
    throw new Error(`設定ファイルを読めない: ${path}`, { cause: err });
  }
}
$ npx eslint src
$ echo $?
0

no-unassigned-vars は、一度も代入しないのに値を読んでいる let と var の変数を報告する。
no-useless-assignment は、代入した値がそのあとどこでも読まれない代入を報告する。
読まれる前に上書きされる場合も、読まれないまま関数が終わる場合も含む。
preserve-caught-error は、catch で受けたエラーを cause に入れずに新しいエラーを投げると報告する。
{ cause: err } を渡せば、元のエラーを新しいエラーの cause から辿れる。

すぐに直せないルールは、設定の rules に "preserve-caught-error": "off" のように書いて 1 つずつ切れる。

JSX のタグ名を変数の参照として数えるようになった

10 は <Card> のような JSX のタグ名を、変数 Card の参照として数える。
9 は数えなかったので、import した部品を JSX でしか使っていないと no-unused-vars が報告した。
定義していない部品を書いても、no-undef は何も言わなかった。

v9 では

$ cat src/App.jsx
import Card from "./Card.jsx";
 
export function App() {
  return (
    <Card>
      <Badge label="new" />
    </Card>
  );
}
$ npx eslint src
/work/v9/jsx-references/src/App.jsx
  1:8  error  'Card' is defined but never used  no-unused-vars
 
✖ 1 problem (1 error, 0 warnings)
$ echo $?
1

v10 に上げると

$ npx eslint src
/work/v10/jsx-references/src/App.jsx
  6:8  error  'Badge' is not defined  no-undef
 
✖ 1 problem (1 error, 0 warnings)
$ echo $?
1

v10 で直すと

$ cat src/App.jsx
import Badge from "./Badge.jsx";
import Card from "./Card.jsx";
 
export function App() {
  return (
    <Card>
      <Badge label="new" />
    </Card>
  );
}
$ npx eslint src
$ echo $?
0

9 では Card に no-unused-vars が出て、import していない Badge は見逃された。
10 では Card への報告が消え、Badge に no-undef が出る。
Badge を import すれば通る。

公式の移行ガイドは、JSX の参照を数えないことへの対策として足していたルール(例に挙げているのは @eslint-react/jsx-uses-vars)は 10 では要らないので、外すか止めるよう書いている。
eslint-plugin-react の react/jsx-uses-vars も、同じ目的のルールである。

検証環境Node.js 24.22.2 / npm 11.19.1 / Python 3.11.2 / 2026-11-08 検証(ほか 9 件)
検証日
実行環境
node:24 Debian GNU/Linux 12 (bookworm)
バージョン
  • Node.js 24.22.2
  • npm 11.19.1
  • Python 3.11.2
  • Git 2.39.5
  • ESLint(旧) 9.39.5
  • ESLint(新) 10.14.0
  • @eslint/js(旧) 9.39.5
  • @eslint/js(新) 10.0.1
  • @eslint/migrate-config 3.0.3
  • eslint-plugin-react 7.37.5
  • React 19.3.1
  • jiti 2.7.0

この記事の「実行例」は、上記の環境で実際にコマンドを実行して得られた出力をそのまま掲載しています。 再現手順はリポジトリの検証スクリプトとして管理し、定期的に再実行して出力を更新しています。