【发布时间】:2020-11-16 23:11:13
【问题描述】:
在我的打字稿项目中,我使用的是 eslint。下面的文件在根目录下,我还有子文件夹/dist 和/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"]
}
上面的module这个词有一条红线表示这个错误
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
我该如何解决这个问题?
【问题讨论】:
-
您的问题已在此处得到解答stackoverflow.com/questions/61956555/…>
标签: node.js typescript eslint