.eslintrc.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. module.exports = {
  2. root: true,
  3. env: {
  4. browser: true,
  5. commonjs: true,
  6. es6: true,
  7. jest: true,
  8. jquery: true,
  9. node: true,
  10. },
  11. 'extends': [
  12. 'eslint:recommended',
  13. 'plugin:vue/recommended',
  14. ],
  15. parserOptions: {
  16. parser: 'babel-eslint'
  17. },
  18. rules: {
  19. 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
  20. 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
  21. 'semi': ['error', 'never'],
  22. "no-unused-vars": ["warn", {
  23. "vars": "all",
  24. "args": "after-used",
  25. "ignoreRestSiblings": false
  26. }],
  27. "keyword-spacing": ["error", { "before": true, "after": true }],
  28. "object-curly-spacing": ["error", "always"],
  29. "space-infix-ops": ["error"],
  30. 'key-spacing': ["error", {
  31. "mode": "strict"
  32. }],
  33. "indent": ["error", 2],
  34. 'no-trailing-spaces': 'error',
  35. 'no-empty': 'off',
  36. // 默认不启用:为了避免细微的 bug,最好直接从 Object.prototype 调用挂载于prototype上的方法方法。例如,foo.hasOwnProperty("bar") 应该替换为 Object.prototype.hasOwnProperty.call(foo, "bar")。
  37. 'no-prototype-builtins': "off",
  38. },
  39. globals: {
  40. // api: true,
  41. // config: true,
  42. // mapGetters: true,
  43. // store: true,
  44. // utils: true,
  45. Hammer: true,
  46. }
  47. }