ESLint 配置(三)Vue 项目
各个版本的 Vue cli 都有 ESLint 和 prettier 选项,在创建项目的时候勾选上会自动安装依赖,很方便。
常用的 eslintConfig:
"eslintConfig": {
"env": {
"browser": true,
"es6": true
},
"extends": [
"eslint:recommended",
"plugin:vue/essential",
"standard",
"plugin:prettier/recommended"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly",
"process": true
},
"parserOptions": {
"parser": "babel-eslint",
"ecmaVersion": 11,
"sourceType": "module"
},
"plugins": [
"vue",
"prettier"
],
"rules": {
"vue/no-parsing-error": [2, { "x-invalid-end-tag": false }],
"prettier/prettier": "error"
}
},
"eslintIgnore": [
"dist/*",
"node_modules/*",
"build/*",
"config/*",
"*.md"
]