これはメモです

それ以上でもそれ以下でもないのです

ESLint Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser. エラー

ViteでTypeScript + React + ESlint(airbnb) の環境構築をしている際に遭遇したエラー。

環境

  • M1 mac Monterey 12.4
  • node v16.13.0
  • npm 8.1.0
  • VSCode

エラー内容

.eslintrc.jsおよびvite.config.tsで下記エラーが出る。

Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: .eslintrc.js.
The file must be included in at least one of the projects provided.

(日本語訳)
解析エラー: "parserOptions.project" は @typescript-eslint/parser に設定されています。
このファイルはプロジェクト設定と一致しません: eslintrc.js
このファイルは、提供されたプロジェクトの少なくとも1つに含まれている必要があります。

当該ファイルが、他のどのファイルからもimportされないことに関するエラーのよう。

それぞれ設定ファイルであり、importされないのは当然のためlint対象から除外する。

lint対象からの除外

.eslintignoreファイルを作成し、当該ファイル名を記述する。

.eslintignore.js
vite.config.js

参考