.eslintrc.js 2.2 KB

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