The problem
Hi, I'm currently setting up a new directory with some linting required but when I set up the eslintrc.json I get this error "parserOptions.project\" has been set for @typescript-eslint/parser.\nThe file does not match your project config: test/src/app.ts The file must be included in at least one of the projects provided.
This issue is purely isolated to VSCode and doesn't occur if I run eslint via the console.
What I have tried
As per these two links I've found via some google searches:
- "parserOptions.project" has been set for @typescript-eslint/parser
- Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser. The file does not match your project config: .eslintrc.js
I have double checked that I have installed the parser and also ensured the eslintrc.json has the path to my tsconfig which is in the same directory.
My Code
eslintrc.json
{
"root": true,
"env": {
"node": true,
"jest": false
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.json"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/array-type": ["error", { "default": "array-simple" }],
"@typescript-eslint/await-thenable": "error"
}
}
tsconfig.json
"compilerOptions": {
"module": "commonjs",
"target": "es2021",
"moduleResolution": "node",
"lib": ["es2021"],
"esModuleInterop": true,
"outDir": "./build",
"sourceMap": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"strictPropertyInitialization": false
},
"exclude": [
"node_modules",
"build"
],
"include": [
"./src"
]
}
My file structure is like this
test
- src (folder)
- app.ts
- eslintrc.json
- tsconfig.json
- package-lock.json
- package.json
Any assistance would be really appreciated, I'll be sticking around if there are any clarifications needed or other questions. Thank you