// ESLint 检查 .vue 文件需要单独配置编辑器：
// https://eslint.vuejs.org/user-guide/#editor-integrations
module.exports = {
  root: true,
  env: {
    browser: true,
    commonjs: true,
    es6: true,
    jest: true,
    jquery: true,
    node: true,
  },
  'extends': [
    'eslint:recommended',
    // "plugin:vue/base",
    'plugin:vue/recommended',
  ],
  parserOptions: {
    parser: 'babel-eslint'
    // "parser": "@babel/eslint-parser"
  },
  rules: {
    'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
    'semi': ['error', 'never'],
    "no-unused-vars": ["warn", {
      "vars": "all",
      "args": "after-used",
      "ignoreRestSiblings": false
    }],
    "keyword-spacing": ["error", { "before": true, "after": true }],
    "object-curly-spacing": ["error", "always"],
    "space-infix-ops": ["error"],
    'key-spacing': ["error", {
      "mode": "strict"
    }],
    "comma-spacing": ["error", { "before": false, "after": true }],
    "func-call-spacing": ["error", "never"],
    "semi-spacing": ["error", { "before": false, "after": true }],
    "space-before-blocks": ["error", "always"],
    'no-trailing-spaces': 'error',
    'no-multi-spaces': 'error',
    "indent": ["error", 2],
    'no-empty': 'off',
    // 默认不启用：为了避免细微的 bug，最好直接从 Object.prototype 调用挂载于prototype上的方法方法。例如，foo.hasOwnProperty("bar") 应该替换为 Object.prototype.hasOwnProperty.call(foo, "bar")。
    'no-prototype-builtins': "off",
  },
  globals: {
    api: true,
    config: true,
    mapState: true,
    mapGetters: true,
    mapMutations: true,
    store: true,
    utils: true,
  }
}