Whenever I open a .vue
file in IntelliJ IDEA, I encounter the following error:
Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: XX\XX\CurrentFile.vue.
The file must be included in at least one of the projects provided.
https://i.sstatic.net/u3Czx.png
I am interested in understanding the root cause of this issue before diving into potential solutions.
My observations regarding this error are as follows:
- The error appears inconsistently.
- Updating eslint triggers the error consistently.
- Running
eslint
from the console on a.vue
file executes without any issues, suggesting that it might not be an eslint bug.
Below is my Eslint configuration in YAML format:
parser: vue-eslint-parser
parserOptions:
parser: "@typescript-eslint/parser"
sourceType: module
project: tsconfig.json
tsconfigRootDir: ./
extraFileExtensions: [ ".vue" ]
env:
es6: true
browser: true
node: true
plugins:
- "@typescript-eslint"
- vue
rules:
// ...
Here are my TypeScript settings in JSON format:
{
"compilerOptions": {
"target": "ES2017",
"module": "CommonJS",
"moduleResolution": "node",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"experimentalDecorators": true,
"skipLibCheck": true,
"strict": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"importsNotUsedAsValues": "preserve", // Limitation of the transpileOnly mode from ts-loader for .vue files.
"baseUrl": "./",
"paths": {
// ...
}
}
}