.eslintrc_20220601114756.js 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. module.exports = {
  2. root: true, // 停止在父级目录中寻找
  3. env: {
  4. es6: true, // 启用 ES6 语法支持以及新的 ES6 全局变量或类型
  5. node: true // Node.js 全局变量和 Node.js 作用域
  6. },
  7. extends: ['plugin:vue/essential', '@vue/standard'],
  8. rules: {
  9. 'no-alert': 0, // 禁止使用alert confirm prompt
  10. 'no-console': 0, // 禁止使用console
  11. 'no-debugger': 0, // 禁止使用debugger
  12. 'prefer-const': 0, // 建议使用 const 关闭
  13. 'no-dupe-keys': 2, // 在创建对象字面量时不允许键重复 {a:1,a:1}
  14. 'no-dupe-args': 2, // 函数参数不能重复
  15. 'no-duplicate-imports': [
  16. 1,
  17. {
  18. includeExports: true
  19. }
  20. ], // 不允许重复导入
  21. 'no-duplicate-case': 2, // switch中的case标签不能重复
  22. 'padded-blocks': 0, // 块语句内行首行尾是否要空行
  23. 'space-after-keywords': [0, 'always'], // 关键字后面是否要空一格
  24. 'space-before-blocks': [0, 'always'], // 不以新行开始的块{前面要不要有空格
  25. 'space-before-function-paren': [0, 'always'], // 函数定义时括号前面要不要有空格
  26. 'space-in-parens': [0, 'never'], // 小括号里面要不要有空格
  27. 'space-infix-ops': 0, // 中缀操作符周围要不要有空格
  28. eqeqeq: 0, // 必须使用全等
  29. 'no-var': 0, // 禁用var,用let和const代替
  30. 'no-inline-comments': 0, // 禁止行内备注
  31. indent: 0,
  32. 'vue/script-indent': 0,
  33. 'vue/require-prop-type-constructor': 0,
  34. 'vue/no-use-v-if-with-v-for': 0,
  35. 'no-trailing-spaces': 0, // 一行结束后面不要有空格
  36. 'no-multiple-empty-lines': 0, // [1, {"max": 2}],空行最多不能超过2行
  37. 'no-extra-boolean-cast': 0, // 禁止不必要的bool转换
  38. 'valid-jsdoc': 0,
  39. 'one-var': 0, // 连续声明
  40. semi: 0, // 语句强制分号结尾
  41. 'semi-spacing': [0, { before: false, after: true }], // 分号前后空格
  42. 'no-new': 0, // 禁止在使用new构造一个实例后不赋值
  43. 'no-extra-semi': 0, // 禁止多余的冒号
  44. 'keyword-spacing': 0,
  45. 'arrow-parens': 0, // 箭头函数用小括号括起来 - 关闭
  46. 'generator-star-spacing': 0, // 生成器函数*的前后空格
  47. 'no-mixed-operators': 0,
  48. 'eol-last': 0, // 文件以单一的换行符结束 - 关闭
  49. 'object-curly-spacing': 0, // 大括号内是否允许不必要的空格
  50. 'no-callback-literal': 0,
  51. 'multiline-ternary': 0
  52. },
  53. parserOptions: {
  54. parser: 'babel-eslint'
  55. },
  56. overrides: [
  57. {
  58. files: ['**/__tests__/*.{j,t}s?(x)', '**/tests/unit/**/*.spec.{j,t}s?(x)'],
  59. env: {
  60. jest: true
  61. }
  62. }
  63. ]
  64. };