ツール
ESLint
JavaScript / TypeScript のための設定可能な静的解析ツール。プラグインで React / Next.js / import 順序などのルールを拡張でき、Prettier やエディタと組み合わせて保存時に自動修正することが多い。
バージョン移行
メジャーバージョンを上げたときに動かなくなることを、旧版と新版で同じコマンドを打ち比べて確かめた。
ESLint 9 → 10・変更点 7 つ
ESLint を 9 から 10 に上げると動かなくなることESLint 8 → 9・変更点 9 つ
ESLint を 8 から 9 に上げると動かなくなること
問題一覧(15)
ESLint「context.getSource is not a function」の原因と直し方
context.getSource is not a function は、ESLint 9 で古い版のプラグインのルールが走ると出る。プラグインを 9 に対応した版に上げるか、@eslint/compat の fixupPluginRules() で包めば直る。
更新: 2026-11-07、タグ: plugin、eslint-plugin-react-hooks、compat
ESLint「Could not find "valid-jsdoc" in plugin "@"」の原因と直し方
Could not find "valid-jsdoc" in plugin "@" は、ESLint 9 で本体から消えたルールが設定に残っていると出る。eslint-plugin-jsdoc の同じ役目のルールに置き換えれば直る。
更新: 2026-11-07、タグ: rules、valid-jsdoc、eslint-plugin-jsdoc
ESLint の eslint-disable-next-line で警告を抑止できない
eslint-disable-next-line が効かないときは、ルール名をエラー出力末尾の (rule-id) と完全一致させれば直ることが多い。JSX 内のコメント形式や対象行のずれも原因になる。
更新: 2026-11-12、タグ: disable、comment、suppression
ESLint「/* eslint-env */ comments are no longer supported」の原因と直し方
/* eslint-env */ comments are no longer supported は、ESLint 10 が eslint-env コメントを見つけると出す。コメントを消し、グローバル変数を設定ファイルの languageOptions.globals に書けば直る。
更新: 2026-11-07、タグ: eslint-env、globals、flat-config
ESLint の --fix で自動修正が適用されない
eslint --fix で直らないのは、そのルールが自動修正に非対応、対象ファイルが ignore されている、--fix-dry-run で書き込んでいない、などが主因。fixable でない指摘は手動修正が必要。
更新: 2026-11-13、タグ: fix、cli、flat-config
ESLint Flat Config (eslint.config.js) が読み込まれない
ESLint v9 から flat config が既定。.eslintrc.* が残っていると衝突する。eslint.config.js の配置・export 形式・プラグイン側 flat 対応の有無を順に確認する。
更新: 2026-11-13、タグ: flat-config、config、migration
ESLint で ignore 指定したファイルが無視されない
ESLint で ignore 指定したファイルが無視されないときは、eslint.config.js に { ignores: [...] } を単独で書けば直る。v9 は .eslintignore を読まない。
更新: 2026-11-14、タグ: ignore、config、flat-config
ESLint「You are using an outdated version of the 'jiti' library」の原因と直し方
You are using an outdated version of the 'jiti' library は、ESLint が eslint.config.ts を古い jiti で読もうとすると出る。npm install -D jiti で新しい版を入れれば直る。
更新: 2026-11-12、タグ: jiti、eslint-config-ts、typescript
ESLint の no-unused-vars が無視できない
no-unused-vars は変数・引数・型・ファイル単位で抑制方法が違う。アンダースコア prefix / disable-next-line / overrides を使い分け、意図した未使用だけ通す設定にする。
更新: 2026-11-14、タグ: no-unused-vars、suppression、disable
ESLint のプラグインで「Cannot find module」が出る原因と直し方
Cannot find module 'eslint-plugin-xxx' は、プラグインのインストール漏れや綴り違いで出る。npm install -D で入れ、flat config では import して渡せば直る。
更新: 2026-11-15、タグ: plugin、flat-config、install
ESLint と Prettier の競合でフォーマットできない
ESLint と Prettier の整形ルールが衝突すると、保存→フォーマット→ESLint→再差分のループになる。eslint-config-prettier で重複ルールを切り、整形は Prettier に一本化するのが定石。
更新: 2026-11-15、タグ: prettier、format、config
ESLint「TSConfig does not include this file」の原因と直し方
TSConfig does not include this file は、lint 対象が tsconfig の範囲外だと出る。projectService に切り替えるか、対象を含む tsconfig を指定すれば直る。
更新: 2026-11-16、タグ: typescript-eslint、parsing-error、tsconfig
ESLint Flat Config で @typescript-eslint/parser が読み込めない
ESLint v9 の Flat Config では parser の指定方法が変わり、typescript-eslint パッケージから parser オブジェクトを受け取って languageOptions.parser に渡す必要がある。文字列指定は使えない。
更新: 2026-11-16、タグ: typescript、parser、flat-config
ESLint「typescript-eslint does not support TS 7.0」の原因と直し方
typescript-eslint does not support TS 7.0 は、typescript@7 で ESLint を動かすと出る。7.0 に typescript-eslint が使う API が無いためで、npm のエイリアスで 6.0 を割り当てれば直る。
更新: 2026-11-06、タグ: typescript-eslint、typescript-7、peer-dependencies
ESLint「Unexpected non-object config at user-defined index 0」の原因と直し方
Unexpected non-object config at user-defined index 0 は、flat config の配列に eslint:recommended を文字列で書くと出る。@eslint/js の js.configs.recommended に置き換えれば直る。
更新: 2026-11-07、タグ: flat-config、eslint-recommended、config