HK *_* S0 7 eslint tsconfig vue.js eslint-plugin-vue
eslint --ext \".js,.ts,.vue\" --ignore-path .gitignore .使用 运行脚本时npm run lint,出现以下错误。
/(somethingSomething...)/Test.vue
0:0 error Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: components/Test.vue.
The extension for the file (.vue) is non-standard. You should add "parserOptions.extraFileExtensions" to your config
Run Code Online (Sandbox Code Playgroud)
我正在使用vue-eslint-parser和eslint-plugin-vue作为 devDependency。并.eslintrc.js包含
...
extends: [
...
'plugin:vue/recommended',
"eslint:recommended"
],
parser: "vue-eslint-parser",
parserOptions: {
parser: "@typescript-eslint/parser",
project: './tsconfig.eslint.json'
},
plugins: [
'html',
'vue',
'jest'
],
...
Run Code Online (Sandbox Code Playgroud)
如手册中所述。并且tsconfig.eslint.json是
{
"extends": "./tsconfig.json",
"include": ["./**/*.ts", "./**/*.js", "./**/*.vue","test/**/*.js"]
}
Run Code Online (Sandbox Code Playgroud)
为什么会出现这些错误,以及如何在 Vue 中使用 lint?
| 归档时间: |
|
| 查看次数: |
3136 次 |
| 最近记录: |