[英]ESLint: prevent from being linted non-standard files extensions
我的.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
文件被檢查。 我錯過了哪個設置?
當您調用 eslint 時,您可以使用—ext
標志告訴它要檢查的文件類型。 要限制配置文件中的文件類型,您必須將所有規則和擴展配置包裝在override
中。
但是,我也會推薦eslint-plugin-json
作為替代解決方案。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.