I'm using the awesome typescript-eslint together with ESLint.
Problem description: the TypeScript ESLint parser complains about src/module.spec.ts
not being part of the project, and this is correct. I'm excluding all spec.ts
files from TypeScript tsconfig.json
file because they don't need to be transpiled.
How to make src/module.spec.ts
not transplied but still checked against ESLint?
my-project\src\module.spec.ts 0:0 error Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser. The file does not match your project config: src\module.spec.ts. The file must be included in at least one of the projects provided
My .eslint.json
(stripped down):
{
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"env": {
"node": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"project": "tsconfig.json"
},
"plugins": [
"@typescript-eslint"
]
}
My tsconfig.json
:
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"declaration": true,
"sourceMap": false,
"outDir": "./dist",
"rootDir": "./src",
"removeComments": true,
"strict": true,
"skipLibCheck": true,
"esModuleInterop": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true
},
"exclude": [
"./dist",
"**/*.spec.ts"
]
}