gpt4 book ai didi

node.js - 如何修复 eslintrc 文件与您的项目配置不匹配?

转载 作者:行者123 更新时间:2023-12-03 12:09:28 31 4
gpt4 key购买 nike

在我的 typescript 项目中,我使用的是 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',
],
}
配置文件
{
"compilerOptions": {
"outDir": "dist",
"noImplicitAny": true,
"moduleResolution": "Node",
"resolveJsonModule": true,
"module": "ES2020",
"target": "ES2020",
"lib": ["ES2020"],
"allowJs": false,
"alwaysStrict": true
},
"include": ["src"]
}
module顶部有一 strip 有此错误的红线
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
我怎样才能解决这个问题?

最佳答案

更新您的 eslintrc.js包括:

ignorePatterns: ['.eslintrc.js']

关于node.js - 如何修复 eslintrc 文件与您的项目配置不匹配?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63118405/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com