.eslintrc.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. module.exports = {
  2. root: true,
  3. env: {
  4. node: true,
  5. },
  6. extends: ['plugin:vue/recommended', 'eslint:recommended', '@vue/prettier'],
  7. parser: 'vue-eslint-parser',
  8. parserOptions: {
  9. ecmaVersion: 2020,
  10. sourceType: 'module',
  11. ecmaFeatures: {
  12. jsx: true,
  13. },
  14. },
  15. rules: {
  16. //'no-undef': 2,
  17. 'no-console': 'off',
  18. 'no-debugger': 'off',
  19. 'vue/no-v-html': 'off',
  20. 'vue/html-self-closing': [
  21. 'error',
  22. {
  23. html: {
  24. void: 'any',
  25. normal: 'any',
  26. component: 'always',
  27. },
  28. svg: 'always',
  29. math: 'always',
  30. },
  31. ],
  32. // Vue.js风格指南(https://cn.vuejs.org/v2/style-guide/)
  33. // Vue组件排序
  34. 'vue/order-in-components': [
  35. 'warn',
  36. {
  37. order: [
  38. 'el',
  39. 'name',
  40. 'key',
  41. 'parent',
  42. 'functional',
  43. ['delimiters', 'comments'],
  44. ['components', 'directives', 'filters'],
  45. 'extends',
  46. 'mixins',
  47. ['provide', 'inject'],
  48. 'ROUTER_GUARDS',
  49. 'layout',
  50. 'middleware',
  51. 'validate',
  52. 'scrollToTop',
  53. 'transition',
  54. 'loading',
  55. 'inheritAttrs',
  56. 'model',
  57. ['props', 'propsData'],
  58. 'emits',
  59. 'setup',
  60. 'fetch',
  61. 'asyncData',
  62. 'data',
  63. 'head',
  64. 'computed',
  65. 'watch',
  66. 'watchQuery',
  67. 'LIFECYCLE_HOOKS',
  68. 'methods',
  69. ['template', 'render'],
  70. 'renderError',
  71. ],
  72. },
  73. ],
  74. // Vue属性排序
  75. 'vue/attributes-order': [
  76. 'warn',
  77. {
  78. order: [
  79. 'DEFINITION',
  80. 'LIST_RENDERING',
  81. 'CONDITIONALS',
  82. 'RENDER_MODIFIERS',
  83. 'GLOBAL',
  84. 'UNIQUE',
  85. 'TWO_WAY_BINDING',
  86. 'OTHER_DIRECTIVES',
  87. 'OTHER_ATTR',
  88. 'EVENTS',
  89. 'CONTENT',
  90. ],
  91. alphabetical: true, //字母顺序
  92. },
  93. ],
  94. },
  95. overrides: [
  96. {
  97. files: [
  98. '**/__tests__/*.{j,t}s?(x)',
  99. '**/tests/unit/**/*.spec.{j,t}s?(x)',
  100. ],
  101. env: {
  102. jest: true,
  103. },
  104. },
  105. ],
  106. }