vue-cli中eslint配置

在项目目录下找到.eslintrc.js文件,使用编辑器打开进行编辑。在rules下添加space-before-function-paren、space-before-blocks、及semi的配置。

module.exports = {
  root: true,
  env: {
    node: true
  },
  'extends': [
    'plugin:vue/essential',
    '@vue/standard'
  ],
  rules: {
    'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
    "space-before-function-paren": 
      ["error", {
        "anonymous": "always",
        "named": "always",
        "asyncArrow": "always"
      }],
      "space-before-blocks": ["error", { "functions": "never", "keywords": "always", "classes": "never" }],
      'semi': ["error", "always"]
  },
  parserOptions: {
    parser: 'babel-eslint'
  }
}

 

posted @ 2019-11-05 20:28  小水皮  阅读(595)  评论(0编辑  收藏  举报