增加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关于eslint规则管理的对象,并再根目录新建.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里头安装eslint并对保存代码自动校验进行配置哦