我的.estintrc.yaml
:
parser: "@typescript-eslint/parser"
parserOptions:
sourceType: module
project: tsconfig.json
tsconfigRootDir: ./
env:
es6: true
browser: true
node: true
mocha: true
plugins:
- "@typescript-eslint"
有了它,我有很多错误,例如:
D:\*****\project\package.json
0:0 error Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: package.json.
The extension for the file (.json) is non-standard. You should add "parserOptions.extraFileExtensions" to your config
我没有要求检查.json
文件。
我只希望.ts
和.vue
文件被掉毛。
我错过了哪个设置?
答案 0 :(得分:0)
调用eslint时,可以使用—ext
标志告诉它要检查的文件类型。要限制配置文件中的文件类型,您必须将所有规则和扩展配置包装在override
中。
不过,我也建议使用eslint-plugin-json
作为替代解决方案。