vuecli4.x eslint 对空格啥的校验不出来
增加standard标准即可
参看配置github:https://github.com/standard/eslint-config-standard
- 先跑命令
npm install --save-dev eslint-config-standard eslint-plugin-promise eslint-plugin-import eslint-plugin-node
- 删除package.json的"eslintConfig"对象,在根目录新建.eslintrc.js中写入
/*
* @Description:
* @Version: 2.0
* @Autor: 王敏
* @Date: 2021-06-28 16:55:13
* @LastEditors: 王敏
* @LastEditTime: 2021-07-01 11:18:53
*/
module.exports = {
root: true,
env: {
node: true
},
globals: {
AMap: null,
AMapUI: null
},
extends: ['plugin:vue/essential', 'eslint:recommended', 'standard'],
rules: {
'no-case-declarations': 1
},
parserOptions: {
parser: 'babel-eslint'
}
}
- 杀掉vscode进程重新进入就可以了,别忘了在vscode里头安装eslint并对保存代码自动校验进行配置哦