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"
]
posted @ 2020-06-05 10:18  Ainsliaea  阅读(401)  评论(0编辑  收藏  举报