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 …
我想使用 linter elint-plugin-vue作为全局node_modules安装,因为我经常使用 Docker,并且我的存储库根目录下可能没有文件夹。
\n之前,我已经像这样安装了 linter:sudo npm install -g eslint eslint-plugin-vue vue-eslint-parser
然而,当/usr/bin/eslint --ext .vue Footer.vue在没有任何东西的情况下运行时node_modules文件夹的情况下运行时,我得到以下信息:
Oops! Something went wrong! :(\n\nESLint: 7.23.0\n\nESLint couldn't find the plugin "eslint-plugin-vue".\n\n(The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "/home/user".)\n\nIt's likely that the plugin isn't installed correctly. Try reinstalling by running the following:\n\n npm install eslint-plugin-vue@latest --save-dev\n\nThe plugin "eslint-plugin-vue" was referenced from the config file in "PersonalConfig".\n\nIf …Run Code Online (Sandbox Code Playgroud) 如何在
<template> </template>.vue 文件的标签内全局禁用 max-len 警告?
我想这样做的原因是我不想
<!-- eslint-disable max-len -->
每次都写。
我也不想在整个 vue 文件中全局禁用它,所以我仍然想在脚本标记中收到警告。