In my typescript project, I am using eslint. The files below are in the root, and I have also subfolders /dist
and /src
.
eslintrc.js
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
},
rules: {
strict: 'error',
semi: ['error', 'always'],
'no-cond-assign': ['error', 'always'],
},
plugins: ['@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
],
}
tsconfig.json
{
"compilerOptions": {
"outDir": "dist",
"noImplicitAny": true,
"moduleResolution": "Node",
"resolveJsonModule": true,
"module": "ES2020",
"target": "ES2020",
"lib": ["ES2020"],
"allowJs": false,
"alwaysStrict": true
},
"include": ["src"]
}
the word module
on top has a red line with this error
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. eslint
How can I fix this?