💐

eslintをv7からv8にアップデート

2024/06/03に公開

やったこと

diff
- "@typescript-eslint/eslint-plugin": "^6.21.0",
- "@typescript-eslint/parser": "^6.21.0",
- "eslint": "^7.29.0",
- "eslint-plugin-jest": "^27.2.3",
+ "@typescript-eslint/eslint-plugin": "^7.9.0",
+ "@typescript-eslint/parser": "^7.9.0",
+ "eslint": "^8.57.0",
+ "eslint-plugin-jest": "^28.5.0",
  • nodeを18.18.0以上に変更
  • @typescript-eslint/eslint-pluginと@typescript-eslint/parserをtypescript-eslintに変更

@typescript-eslint v7の要件

  • node v18.18.0以上
  • ESLint の最小バージョンが v8.56.0

https://github.com/typescript-eslint/typescript-eslint/pull/8377

@typescript-eslint/XXtypescript-eslintに統合された

https://typescript-eslint.io/blog/announcing-typescript-eslint-v7/

typescript-eslintに移行するにはFlat Configに変更する必要があったが、移行後eslintを実行するとエラーが発生
eslint-config-nextもアップデートしてみたが変わらず
Flat Configはv9でデフォルトとなり、v10で完全に削除されるのでv9で対応することにした

https://zenn.dev/mayobimu/scraps/8c5f239324c514

Oops! Something went wrong! :(

ESLint: 8.57.0

Error: Failed to patch ESLint because the calling module was not recognized.
If you are using a newer ESLint version that may be unsupported, please create a GitHub issue:
https://github.com/microsoft/rushstack/issues
    at Object.<anonymous> (/XXX/node_modules/@rushstack/eslint-patch/lib/modern-module-resolution.js:141:19)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (/XXX/node_modules/@rushstack/eslint-patch/modern-module-resolution.js:1:1)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Discussion