ESLint を 8 から 9 に上げると動かなくなること
ESLint を 8 から 9 に上げると、.eslintrc.* が読まれず「couldn't find an eslint.config」で止まり、valid-jsdoc や古いプラグインも TypeError で落ちる。
8 と 9 で打ち比べた 9 つの変更点と直し方をまとめる。
公開: 更新:
eslint@8 を入れたプロジェクトと eslint@9 を入れたプロジェクトを並べ、同じコマンドを打ち比べた。
各節の出力は「v8 では」「v9 に上げると」「v9 で直すと」の 3 段で並ぶ。
旧版は 8.x の最後の 8.57.1、新版は 9.x の最後の 9.39.5 である。
9.0 でいちばん大きく変わったのは設定ファイルで、9 は eslint.config.js の形式(flat config)だけを探す。.eslintrc.* しか無いプロジェクトは、どのファイルも検査する前に止まる。
3 つ目以降の節の v9 側は、設定を eslint.config.mjs に移したあとのプロジェクトで打った。
移したあとも、.eslintignore や /* eslint-env */ のように、止まらずに黙って効かなくなるものがある。
9.x のサポートは 2026-08-06 に終わっている。
npm も 9.39.5 を入れると This version is no longer supported と警告する(最後の節の出力)。
8 から 9 に上げたあとは、続けて 10 に上げることになる(ESLint を 9 から 10 に上げると動かなくなること)。
次の変更は、ここでは打っていない。
どれも公式の移行ガイドに載っている。
- Node.js 18.18 未満と 19 が、サポートの対象から外れた。
- 公式の codemod
npx codemod @eslint/v8-to-v9-configは、8 の設定ファイルを flat config に書き換える。 --quietを付けると、"warn"のルールを実行しなくなった。- ファイルやディレクトリを渡さずに
eslintを打つと、今いるディレクトリを検査するようになった。 /* eslint */コメントで深刻度だけを書くと、設定ファイルのオプションを引き継ぐようになり、同じルールを 2 回書くとエラーになった。no-inner-declarationsとno-useless-computed-keyの既定の動きが変わった。
.eslintrc が読まれなくなった
8.x は .eslintrc.json などの従来の形式(eslintrc)を読んだ。
9.0 からは既定で flat config の設定ファイルだけを探し、見つからなければ終了コード 2 で止まる。
9.0 が探すのは eslint.config.js・eslint.config.mjs・eslint.config.cjs の 3 つで、後の 9.x は eslint.config.ts なども探す(9.39.5 のソースの一覧による)。
v8 では
$ cat .eslintrc.json
{
"root": true,
"extends": "eslint:recommended",
"env": { "browser": true },
"parserOptions": { "ecmaVersion": "latest", "sourceType": "module" },
"rules": { "no-console": "warn" }
}$ npx eslint src
/work/v8/eslint-config/src/index.js
2:3 warning Unexpected console statement no-console
✖ 1 problem (0 errors, 1 warning)
$ echo $?
0v9 に上げると
$ npx eslint src
Oops! Something went wrong! :(
ESLint: 9.39.5
ESLint couldn't find an eslint.config.(js|mjs|cjs) file.
From ESLint v9.0.0, the default configuration file is now eslint.config.js.
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 $?
2v9 で直すと
$ env ESLINT_USE_FLAT_CONFIG=false npx eslint src
/work/v9/eslint-config/src/index.js
2:3 warning Unexpected console statement no-console
✖ 1 problem (0 errors, 1 warning)
(node:164) 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$ npx --yes @eslint/migrate-config .eslintrc.json
Migrating .eslintrc.json
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 } 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([{
extends: compat.extends("eslint:recommended"),
languageOptions: {
globals: {
...globals.browser,
},
ecmaVersion: "latest",
sourceType: "module",
},
rules: {
"no-console": "warn",
},
}]);$ npm install -D globals @eslint/js @eslint/eslintrc
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: @eslint/js@10.0.1
npm error Found: 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 dev eslint@"^9.39.5" from the root project
npm error
npm error Could not resolve dependency:
npm error peerOptional eslint@"^10.0.0" from @eslint/js@10.0.1
npm error node_modules/@eslint/js
npm error dev @eslint/js@"*" 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@"*" 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_46_157Z-eresolve-report.txt
npm error A complete log of this run can be found in: /root/.npm/_logs/2026-11-08T03_36_46_157Z-debug-0.log
$ echo $?
1$ npm install -D globals @eslint/js@9 @eslint/eslintrc
added 1 package, and changed 1 package in 586ms
$ echo $?
0$ npx eslint src
/work/v9/eslint-config/src/index.js
2:3 warning Unexpected console statement no-console
✖ 1 problem (0 errors, 1 warning)
$ echo $?
0環境変数 ESLINT_USE_FLAT_CONFIG=false を付けると、9 でも .eslintrc.json を読む。
ただし ESLintRCWarning の文面どおり、この逃げ道は 10.0 で無くなる。
移すときは、@eslint/migrate-config が .eslintrc.json から eslint.config.mjs を書き出す。
書き出した設定は eslint:recommended を FlatCompat で読み込むので、@eslint/eslintrc が要る。
表示された npm install globals @eslint/js @eslint/eslintrc -D をそのまま打つと、ERESOLVE で止まった。
版を付けない @eslint/js は 10.x が選ばれ、その peerDependencies が eslint@^10.0.0 だからである。@eslint/js@9 と版をそろえると入り、npx eslint src は v8 と同じ警告を出した。
compat.extends("eslint:recommended") は、次の節の js.configs.recommended に置き換えられる。
置き換えれば FlatCompat と @eslint/eslintrc は要らない。
eslint:recommended を文字列で書けなくなった
8.x の後半は flat config の eslint.config.js も読めて、設定の配列に "eslint:recommended" という文字列を書けた。
8.57.1 は非推奨の警告を出すだけで検査を続けた。
9.0 では配列に文字列を書けなくなり、TypeError で止まる。
v8 では
$ cat eslint.config.js
module.exports = ["eslint:recommended"];$ npx eslint src
(node:347) Warning: The 'eslint:recommended' string configuration is deprecated and will be replaced by the @eslint/js package's 'recommended' config.
(Use `node --trace-warnings ...` to show where the warning was created)
$ echo $?
0v9 に上げると
$ npx eslint src
Oops! Something went wrong! :(
ESLint: 9.39.5
TypeError: Config (unnamed): Unexpected non-object config at user-defined index 0.
at wrapConfigErrorWithDetails (/work/v9/recommended-string/node_modules/eslint/lib/config/flat-config-array.js:63:9)
at /work/v9/recommended-string/node_modules/eslint/lib/config/flat-config-array.js:140:11
at async ConfigLoader.calculateConfigArray (/work/v9/recommended-string/node_modules/eslint/lib/config/config-loader.js:663:3)
at async #calculateConfigArray (/work/v9/recommended-string/node_modules/eslint/lib/config/config-loader.js:743:23)
at async entryFilter (/work/v9/recommended-string/node_modules/eslint/lib/eslint/eslint-helpers.js:322:5)
at async NodeHfs.<anonymous> (file:///work/v9/recommended-string/node_modules/@humanfs/core/src/hfs.js:574:24)
at async NodeHfs.walk (file:///work/v9/recommended-string/node_modules/@humanfs/core/src/hfs.js:614:3)
at async globSearch (/work/v9/recommended-string/node_modules/eslint/lib/eslint/eslint-helpers.js:364:20)
at async Promise.allSettled (index 0)
at async globMultiSearch (/work/v9/recommended-string/node_modules/eslint/lib/eslint/eslint-helpers.js:455:18)
$ echo $?
2v9 で直すと
$ npm install -D @eslint/js@9
up to date in 192ms
$ echo $?
0$ cat eslint.config.js
const js = require("@eslint/js");
module.exports = [js.configs.recommended];$ npx eslint src
/work/v9/recommended-string/src/list.js
2:19 error Unexpected comparison to newly constructed object. These two values can never be equal no-constant-binary-expression
✖ 1 problem (1 error, 0 warnings)
$ echo $?
1$ cat src/list.js
export function isEmpty(list) {
return list.length === 0;
}$ npx eslint src
$ echo $?
0文字列の代わりに、@eslint/js の js.configs.recommended を置く。@eslint/js は ESLint 本体の依存として同じ版がもう入っていたので、npm install は up to date と出た。
設定から import するパッケージなので、自分の package.json にも書いておく。
置き換えると、v8 では通った list === [] が no-constant-binary-expression で落ちた。
9.0 の eslint:recommended には、このルールを含む 4 つのルールが加わった。
残りの 3 つは no-empty-static-block・no-new-native-nonconstructor・no-unused-private-class-members である。
反対に no-extra-semi・no-inner-declarations・no-mixed-spaces-and-tabs・no-new-symbol の 4 つは recommended から外れた。
list === [] は新しく作った配列との比較なので、常に false になる。
8 の recommended では見逃していた不具合が、9 に上げると見つかる。
.eslintignore が読まれなくなった
8.x では、.eslintignore に書いたパスを検査から外せた。
9.0 の flat config はこのファイルを読まない。
v8 では
$ cat .eslintignore
dist/$ npx eslint .
$ echo $?
0v9 に上げると
$ cat eslint.config.mjs
import js from "@eslint/js";
import { defineConfig } from "eslint/config";
export default defineConfig([js.configs.recommended]);$ npx eslint .
(node:542) 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#ignoring-files
(Use `node --trace-warnings ...` to show where the warning was created)
/work/v9/eslintignore/dist/bundle.js
1:5 error 'a' is assigned a value but never used no-unused-vars
1:18 error 'b' is defined but never used no-unused-vars
✖ 2 problems (2 errors, 0 warnings)
$ echo $?
1v9 で直すと
$ cat eslint.config.mjs
import js from "@eslint/js";
import { defineConfig, globalIgnores } from "eslint/config";
export default defineConfig([
globalIgnores(["dist/"]),
js.configs.recommended,
]);$ npx eslint .
$ echo $?
09 は ESLintIgnoreWarning を出すが、止まらずに dist/ の中まで検査した。
ビルドで作った JavaScript が no-unused-vars で落ち、終了コードは 1 になった。
外すパスは、設定ファイルの globalIgnores() に書く。{ ignores: ["dist/"] } のように ignores だけを書いたオブジェクトも同じ意味になる。
.eslintignore の行は、そのまま写すと意味が変わるものがある。
公式の設定の移行ガイドによると、.eslintignore の temp.js はどのディレクトリの temp.js も外した。
flat config の temp.js は設定ファイルと同じディレクトリのものしか外さないので、**/temp.js と書く。. で始まるファイルも flat config では既定で外れなくなったので、外すなら "**/.*" を足す。
ignores を rules などと同じオブジェクトに書くと、そのオブジェクトの中だけの除外になり、ファイルは検査されたままになる(公式のドキュメント「Configuration Files」による)。
--ignore-path などの CLI オプションが使えなくなった
8.x では、--ignore-path .gitignore を付けると、.gitignore を除外の一覧として読ませられた。
9.0 の flat config では、--ignore-path・--rulesdir・--env・--no-eslintrc・--resolve-plugins-relative-to が使えない。package.json の scripts に書いていると、npm run lint がここで止まる。
v8 では
$ cat .gitignore
node_modules/
dist/$ npx eslint --ignore-path .gitignore .
$ echo $?
0v9 に上げると
$ npx eslint --ignore-path .gitignore .
Invalid option '--ignore-path' - perhaps you meant '--ignore-pattern'?
You're using eslint.config.js, some command line flags are no longer available. Please see https://eslint.org/docs/latest/use/command-line-interface for details.
$ echo $?
2$ npx eslint --rulesdir rules src
Invalid option '--rulesdir' - perhaps you meant '--rule'?
You're using eslint.config.js, some command line flags are no longer available. Please see https://eslint.org/docs/latest/use/command-line-interface for details.
$ echo $?
2$ npx eslint --ext .js src
$ echo $?
0v9 で直すと
$ node -p 'typeof require("eslint/config").includeIgnoreFile'
undefined$ npm install -D @eslint/config-helpers
added 2 packages, and changed 1 package in 208ms
$ echo $?
0$ cat eslint.config.mjs
import path from "node:path";
import { includeIgnoreFile } from "@eslint/config-helpers";
import js from "@eslint/js";
import { defineConfig } from "eslint/config";
export default defineConfig([
includeIgnoreFile(path.join(import.meta.dirname, ".gitignore")),
js.configs.recommended,
]);$ npx eslint .
$ echo $?
0--ext は 9.0 でいったん消えたが、9.21.0 で戻った。
9.39.5 では --ext .js を付けても通る。
.gitignore を除外に使うには、includeIgnoreFile() に .gitignore の絶対パスを渡す。
公式の設定の移行ガイドのコード例は @eslint/compat から読み込んでいる。
ただし 2026-05-01 の注記で、そちらは非推奨になり、@eslint/config-helpers の includeIgnoreFile()(eslint/config からも読める)を使うよう書き足された。
9.39.5 の eslint/config には includeIgnoreFile が無く、undefined が返った。@eslint/config-helpers を直接入れて読み込むと、v8 と同じく dist/ を外して検査が通った。
--rulesdir で読ませていた自作のルールは、設定ファイルの plugins にオブジェクトとして渡す。--env の代わりは、次の節の globals である。
junit などのフォーマッターが本体から外れた
8.x の本体には、-f junit や -f checkstyle で選べる出力の形式(フォーマッター)がいくつも入っていた。
9.0 で checkstyle・compact・jslint-xml・junit・tap・unix・visualstudio の 7 つが本体から外れ(公式の移行ガイドによる)、-f junit は終了コード 2 で止まる。
v8 では
$ npx eslint -f junit src
<?xml version="1.0" encoding="utf-8"?>
<testsuites>
<testsuite package="org.eslint" time="0" tests="1" errors="0" name="/work/v8/formatters/src/index.js">
<testcase time="0" name="/work/v8/formatters/src/index.js" classname="/work/v8/formatters/src/index" />
</testsuite>
</testsuites>
$ echo $?
0v9 に上げると
$ npx eslint -f junit src
The junit formatter is no longer part of core ESLint. Install it manually with `npm install -D eslint-formatter-junit`
$ echo $?
2v9 で直すと
$ npm install -D eslint-formatter-junit
added 1 package in 482ms
$ echo $?
0$ npx eslint -f junit src
<?xml version="1.0" encoding="utf-8"?>
<testsuites>
<testsuite package="org.eslint" time="0" tests="1" errors="0" name="/work/v9/formatters/src/index.js">
<testcase time="0" name="/work/v9/formatters/src/index.js" classname="/work/v9/formatters/src/index" />
</testsuite>
</testsuites>
$ echo $?
0エラーの文のとおり、フォーマッターのパッケージを入れる。eslint-formatter-junit を入れると、同じ -f junit で v8 と同じ形の XML が出た。
ほかの 6 つも eslint-formatter-checkstyle のように、eslint-formatter- の後ろにフォーマッターの名前を付けたパッケージになっている(公式の移行ガイドの表による)。
eslint-env コメントが効かなくなった
8.x では、ファイルの先頭に /* eslint-env node */ と書くと、そのファイルで Node.js のグローバル変数(process など)を使えた。
9.0 の flat config はこのコメントを読まない。
v8 では
$ cat src/server.js
/* eslint-env node */
const port = process.env.PORT || 3000;
console.log(`listening on ${port}`);$ npx eslint src
$ echo $?
0v9 に上げると
$ npx eslint src
/work/v9/eslint-env/src/server.js
2:14 error 'process' is not defined no-undef
3:1 error 'console' is not defined no-undef
✖ 2 problems (2 errors, 0 warnings)
(node:1025) 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/server.js at line 1.
(Use `node --trace-warnings ...` to show where the warning was created)
$ echo $?
1v9 で直すと
$ npm install -D globals
added 1 package, and changed 1 package in 228ms
$ echo $?
0$ cat eslint.config.mjs
import js from "@eslint/js";
import { defineConfig } from "eslint/config";
import globals from "globals";
export default defineConfig([
js.configs.recommended,
{ languageOptions: { globals: globals.node } },
]);$ cat src/server.js
const port = process.env.PORT || 3000;
console.log(`listening on ${port}`);$ npx eslint src
$ echo $?
09 は ESLintEnvWarning を出したうえで、process と console を no-undef で報告した。
flat config では、設定に書かないかぎりブラウザや Node.js のグローバル変数は定義されない。
警告の文面にあるとおり、10.0 からはこのコメント自体がエラーになる。
globals パッケージを入れ、languageOptions.globals に globals.node を渡す。
ブラウザで動くファイルには globals.browser を渡す。
両方が混ざるプロジェクトは、files で対象を絞ったオブジェクトを 2 つに分ける。
no-unused-vars が catch の引数も報告するようになった
no-unused-vars は、使っていない変数を報告するルールである。
8.x では catch (err) の err を使わなくても報告しなかった。
9.0 で caughtErrors の既定が "none" から "all" に変わり、catch の引数も報告の対象になった。
v8 では
$ cat src/parse.js
export function parseJson(text) {
try {
return JSON.parse(text);
} catch (err) {
return null;
}
}$ npx eslint src
$ echo $?
0v9 に上げると
$ npx eslint src
/work/v9/caught-errors/src/parse.js
4:12 error 'err' is defined but never used no-unused-vars
✖ 1 problem (1 error, 0 warnings)
$ echo $?
1v9 で直すと
$ cat src/parse.js
export function parseJson(text) {
try {
return JSON.parse(text);
} catch {
return null;
}
}$ npx eslint src
$ echo $?
0$ cat src/parse.js
export function parseJson(text) {
try {
return JSON.parse(text);
} catch (err) {
return null;
}
}$ cat eslint.config.mjs
import js from "@eslint/js";
import { defineConfig } from "eslint/config";
export default defineConfig([
js.configs.recommended,
{ rules: { "no-unused-vars": ["error", { caughtErrors: "none" }] } },
]);$ npx eslint src
$ echo $?
0使わない引数は、catch { と書いて省ける。
ES2019 で入った書き方で、9 の既定の ecmaVersion で読める。
8 と同じ扱いに戻したいときは、caughtErrors: "none" を指定する。
8 で varsIgnorePattern に頼って catch (_e) を通していた設定は、9 では効かない(公式の移行ガイドによる)。catch の引数の名前の決まりは caughtErrorsIgnorePattern に書く。
valid-jsdoc と require-jsdoc が無くなった
valid-jsdoc と require-jsdoc は 2018 年から非推奨で、9.0 で消えた。
設定にルールの名前が残っていると、@(本体のルールの置き場)にそのルールが無いと言って止まる。
どのファイルも検査せずに、終了コードは 2 になる。
v8 では
$ cat src/math.js
/**
* 2 つの数を足す。
* @param {number} a
* @param {number} c
* @returns {number}
*/
export function add(a, b) {
return a + b;
}
export function sub(a, b) {
return a - b;
}$ cat .eslintrc.json
{
"root": true,
"parserOptions": { "ecmaVersion": "latest", "sourceType": "module" },
"rules": { "valid-jsdoc": "error", "require-jsdoc": "error" }
}$ npx eslint src
/work/v8/jsdoc-rules/src/math.js
1:1 error Missing JSDoc return description valid-jsdoc
3:4 error Missing JSDoc parameter description for 'a' valid-jsdoc
4:4 error Missing JSDoc parameter description for 'c' valid-jsdoc
4:4 error Expected JSDoc for 'b' but found 'c' valid-jsdoc
11:8 error Missing JSDoc comment require-jsdoc
✖ 5 problems (5 errors, 0 warnings)
$ echo $?
1v9 に上げると
$ cat eslint.config.mjs
import { defineConfig } from "eslint/config";
export default defineConfig([
{
rules: {
"valid-jsdoc": "error",
"require-jsdoc": "error",
},
},
]);$ npx eslint src
Oops! Something went wrong! :(
ESLint: 9.39.5
TypeError: Key "rules": Key "valid-jsdoc": Could not find "valid-jsdoc" in plugin "@".
at throwRuleNotFoundError (/work/v9/jsdoc-rules/node_modules/eslint/lib/config/config.js:100:16)
at Config.validateRulesConfig (/work/v9/jsdoc-rules/node_modules/eslint/lib/config/config.js:603:5)
at new Config (/work/v9/jsdoc-rules/node_modules/eslint/lib/config/config.js:484:9)
at [finalizeConfig] (/work/v9/jsdoc-rules/node_modules/eslint/lib/config/flat-config-array.js:212:10)
at FlatConfigArray.getConfigWithStatus (/work/v9/jsdoc-rules/node_modules/@eslint/config-array/dist/cjs/index.cjs:1409:55)
at FlatConfigArray.getConfig (/work/v9/jsdoc-rules/node_modules/@eslint/config-array/dist/cjs/index.cjs:1427:15)
at entryFilter (/work/v9/jsdoc-rules/node_modules/eslint/lib/eslint/eslint-helpers.js:323:27)
at async NodeHfs.<anonymous> (file:///work/v9/jsdoc-rules/node_modules/@humanfs/core/src/hfs.js:574:24)
at async NodeHfs.walk (file:///work/v9/jsdoc-rules/node_modules/@humanfs/core/src/hfs.js:614:3)
at async globSearch (/work/v9/jsdoc-rules/node_modules/eslint/lib/eslint/eslint-helpers.js:364:20)
$ echo $?
2v9 で直すと
$ npm install -D eslint-plugin-jsdoc
added 41 packages in 3s
$ echo $?
0$ cat eslint.config.mjs
import { defineConfig } from "eslint/config";
import jsdoc from "eslint-plugin-jsdoc";
export default defineConfig([
{
plugins: { jsdoc },
rules: {
"jsdoc/require-jsdoc": "error",
"jsdoc/require-param": "error",
"jsdoc/check-param-names": "error",
"jsdoc/require-param-description": "error",
"jsdoc/require-returns-description": "error",
},
},
]);$ npx eslint src
/work/v9/jsdoc-rules/src/math.js
1:1 error Missing JSDoc @param "b" declaration jsdoc/require-param
3:1 error Missing JSDoc @param "a" description jsdoc/require-param-description
4:1 error Expected @param names to be "a, b". Got "a, c" jsdoc/check-param-names
4:1 error Missing JSDoc @param "c" description jsdoc/require-param-description
5:1 error Missing JSDoc @returns description jsdoc/require-returns-description
11:8 error Missing JSDoc comment jsdoc/require-jsdoc
✖ 6 problems (6 errors, 0 warnings)
2 errors and 0 warnings potentially fixable with the `--fix` option.
$ echo $?
1$ npm ls eslint
jsdoc-rules@1.0.0 /work/v9/jsdoc-rules
+-- eslint-plugin-jsdoc@65.4.5
| +-- @typescript-eslint/utils@8.72.1
| | `-- eslint@9.39.5 deduped
| `-- eslint@9.39.5 deduped
`-- eslint@9.39.5
`-- @eslint-community/eslint-utils@4.10.1
`-- eslint@9.39.5 deduped代わりは eslint-plugin-jsdoc のルールである。require-jsdoc は jsdoc/require-jsdoc が引き継ぐ。valid-jsdoc が 1 つで見ていたことは、jsdoc/check-param-names や jsdoc/require-param-description などに分かれた。
v8 の valid-jsdoc は、@param の c と引数の b の食い違いを 1 件で報告した。
プラグインは同じ食い違いを、b の @param が無いことと、名前の並びが a, b でないことの 2 件に分けて報告した。
eslint-plugin-jsdoc の peerDependencies は ESLint 10 まで含む。
9.39.5 を入れたプロジェクトでは、npm ls eslint のとおり 9 をそのまま使った。
古いプラグインが context.getSource で落ちるようになった
9.0 で、ルールに渡す context から getSource()・getScope()・getAncestors() などのメソッドが消え、context.sourceCode の側に移った。
古い版のプラグインは消えたメソッドを呼ぶので、そのルールが走ったところで TypeError になる。
ここでは eslint-plugin-react-hooks 4.6.0 の exhaustive-deps で確かめた。
v8 では
$ cat .eslintrc.json
{
"root": true,
"parserOptions": { "ecmaVersion": "latest", "sourceType": "module" },
"plugins": ["react-hooks"],
"rules": {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn"
}
}$ npx eslint src
/work/v8/plugin-context/src/Counter.js
8:6 warning React Hook useEffect has a missing dependency: 'step'. Either include it or remove the dependency array. If 'setCount' needs the current value of 'step', you can also switch to useReducer instead of useState and read 'step' in the reducer react-hooks/exhaustive-deps
✖ 1 problem (0 errors, 1 warning)
$ echo $?
0v9 に上げると
$ npm install -D eslint@9
npm warn ERESOLVE overriding peer dependency
npm warn While resolving: plugin-context@1.0.0
npm warn Found: eslint@8.57.1
npm warn node_modules/eslint
npm warn peer eslint@"^6.0.0 || ^7.0.0 || >=8.0.0" from @eslint-community/eslint-utils@4.10.1
npm warn node_modules/@eslint-community/eslint-utils
npm warn @eslint-community/eslint-utils@"^4.2.0" from eslint@8.57.1
npm warn 2 more (eslint-plugin-react-hooks, the root project)
npm warn
npm warn Could not resolve dependency:
npm warn peer eslint@"^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0" from eslint-plugin-react-hooks@4.6.0
npm warn node_modules/eslint-plugin-react-hooks
npm warn dev eslint-plugin-react-hooks@"^4.6.0" from the root project
npm warn deprecated eslint@9.39.5: This version is no longer supported. Please see https://eslint.org/version-support for other options.
added 13 packages, removed 25 packages, and changed 8 packages in 581ms
$ echo $?
0$ cat eslint.config.mjs
import { defineConfig } from "eslint/config";
import reactHooks from "eslint-plugin-react-hooks";
export default defineConfig([
{
plugins: { "react-hooks": reactHooks },
rules: {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
},
},
]);$ npx eslint src
Oops! Something went wrong! :(
ESLint: 9.39.5
TypeError: context.getSource is not a function
Occurred while linting /work/v9/plugin-context/src/Counter.js:5
Rule: "react-hooks/exhaustive-deps"
at visitFunctionWithDependencies (/work/v9/plugin-context/node_modules/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js:1704:42)
at visitCallExpression (/work/v9/plugin-context/node_modules/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js:1759:11)
at ruleErrorHandler (/work/v9/plugin-context/node_modules/eslint/lib/linter/linter.js:1173:33)
at /work/v9/plugin-context/node_modules/eslint/lib/linter/source-code-visitor.js:76:46
at Array.forEach (<anonymous>)
at SourceCodeVisitor.callSync (/work/v9/plugin-context/node_modules/eslint/lib/linter/source-code-visitor.js:76:30)
at /work/v9/plugin-context/node_modules/eslint/lib/linter/source-code-traverser.js:291:18
at Array.forEach (<anonymous>)
at SourceCodeTraverser.traverseSync (/work/v9/plugin-context/node_modules/eslint/lib/linter/source-code-traverser.js:290:10)
at runRules (/work/v9/plugin-context/node_modules/eslint/lib/linter/linter.js:1214:12)
$ echo $?
2v9 で直すと
$ npm install -D @eslint/compat
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: eslint-plugin-react-hooks@4.6.0
npm error Found: 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 dev eslint@"^9.39.5" from the root project
npm error 1 more (@eslint/compat)
npm error
npm error Could not resolve dependency:
npm error peer eslint@"^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0" from eslint-plugin-react-hooks@4.6.0
npm error node_modules/eslint-plugin-react-hooks
npm error dev eslint-plugin-react-hooks@"^4.6.0" from the root project
npm error
npm error Conflicting peer dependency: eslint@8.57.1
npm error node_modules/eslint
npm error peer eslint@"^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0" from eslint-plugin-react-hooks@4.6.0
npm error node_modules/eslint-plugin-react-hooks
npm error dev eslint-plugin-react-hooks@"^4.6.0" 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_37_20_853Z-eresolve-report.txt
npm error A complete log of this run can be found in: /root/.npm/_logs/2026-11-08T03_37_20_853Z-debug-0.log
$ echo $?
1$ npm install -D --legacy-peer-deps @eslint/compat
added 2 packages in 463ms
$ echo $?
0$ cat eslint.config.mjs
import { fixupPluginRules } from "@eslint/compat";
import { defineConfig } from "eslint/config";
import reactHooks from "eslint-plugin-react-hooks";
export default defineConfig([
{
plugins: { "react-hooks": fixupPluginRules(reactHooks) },
rules: {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
},
},
]);$ npx eslint src
/work/v9/plugin-context/src/Counter.js
8:6 warning React Hook useEffect has a missing dependency: 'step'. Either include it or remove the dependency array. If 'setCount' needs the current value of 'step', you can also switch to useReducer instead of useState and read 'step' in the reducer react-hooks/exhaustive-deps
✖ 1 problem (0 errors, 1 warning)
$ echo $?
0$ npm install -D eslint-plugin-react-hooks@latest
added 41 packages, and changed 1 package in 2s
$ echo $?
0$ cat eslint.config.mjs
import { defineConfig } from "eslint/config";
import reactHooks from "eslint-plugin-react-hooks";
export default defineConfig([
{
plugins: { "react-hooks": reactHooks },
rules: {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
},
},
]);$ npx eslint src
/work/v9/plugin-context/src/Counter.js
8:6 warning React Hook useEffect has a missing dependency: 'step'. Either include it or remove the dependency array. If 'setCount' needs the current value of 'step', you can also switch to useReducer instead of useState and read 'step' in the reducer react-hooks/exhaustive-deps
✖ 1 problem (0 errors, 1 warning)
$ echo $?
0npm install -D eslint@9 は、プラグインの peerDependencies(ESLint 8 まで)に合わないと警告しただけで、終了コード 0 で入った。
ところが続けて @eslint/compat を入れようとすると、ERESOLVE で止まった。--legacy-peer-deps を付けると入った。
直し方は 2 通りある。
9 に対応した版が出ているプラグインは、その版に上げる。eslint-plugin-react-hooks は 7.1.1 に上げると、設定を変えずに v8 と同じ警告を出した。
更新が止まったプラグインは、@eslint/compat の fixupPluginRules() で包むと、消えたメソッドが補われて動く。
出力は fixupPluginRules() を先に試し、そのあとプラグインを上げた順に並んでいる。
context.getScope is not a function のように、メソッドの名前だけが違うエラーも原因は同じである。
自作のルールなら、context.getSource() を context.sourceCode.getText() に、context.getScope() を context.sourceCode.getScope(node) に書き換える。
検証環境Node.js 24.22.2 / npm 11.19.1 / Python 3.11.2 / 2026-11-08 検証(ほか 13 件)
- 検証日
- 実行環境
node:24Debian GNU/Linux 12 (bookworm)- バージョン
- Node.js 24.22.2
- npm 11.19.1
- Python 3.11.2
- Git 2.39.5
- ESLint(旧) 8.57.1
- ESLint(新) 9.39.5
- @eslint/js 9.39.5
- @eslint/eslintrc 3.3.7
- globals 17.14.0
- @eslint/migrate-config 3.0.3
- @eslint/config-helpers 0.7.0
- eslint-formatter-junit 9.0.1
- eslint-plugin-jsdoc 65.4.5
- eslint-plugin-react-hooks(旧) 4.6.0
- @eslint/compat 2.1.1
- eslint-plugin-react-hooks(新) 7.1.1
この記事の「実行例」は、上記の環境で実際にコマンドを実行して得られた出力をそのまま掲載しています。 再現手順はリポジトリの検証スクリプトとして管理し、定期的に再実行して出力を更新しています。