vue-cli 的 eslint 插件
-
vue-cli-service lint
使用:vue-cli-service lint [options] [...files] 选项: --format [formatter] 指定格式器 (默认值:codeframe) --no-fix 不修复错误 --max-errors 指定使构建失败的错误数量 (默认值:0) --max-warnings 指定使构建失败的警告数量 (默认值:Infinity)
校验并修复文件中的错误。如果没有指定文件,则会校验
src
和test
中的所有文件。也支持其它 ESLint CLI 的选项。
ESLint 可以通过 .eslintrc
或 package.json
中的 eslintConfig
字段进行配置。
通过 eslint-loader
在每次保存时执行校验的选项是默认开启的,你也可以通过 vue.config.js
中的 lintOnSave
选项将其关闭。
module.exports = {
lintOnSave: false
}
vue add @vue/eslint
config.rule('eslint')
config.rule('eslint').use('eslint-loader')
config.module.rule('eslint')
config.module.rule('eslint').use('eslint-loader')