.eslintrc.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /**
  2. * @author https://github.com/zxwk1998/vue-admin-better (不想保留author可删除)
  3. * @description .eslintrc.js
  4. */
  5. module.exports = {
  6. root: true,
  7. env: {
  8. node: true,
  9. },
  10. extends: ['plugin:vue/recommended', 'eslint:recommended', '@vue/prettier'],
  11. rules: {
  12. 'no-undef': 'off',
  13. 'no-console': 'off',
  14. 'no-debugger': 'off',
  15. 'prettier/prettier': 'off',
  16. 'prefer-template': 'error',
  17. '@typescript-eslint/no-this-alias': 'off',
  18. '@typescript-eslint/no-explicit-any': 'off',
  19. '@typescript-eslint/no-var-requires': 'off',
  20. '@typescript-eslint/no-empty-function': 'off',
  21. '@typescript-eslint/ban-ts-comment': 'off',
  22. 'vue/no-reserved-component-names': 'off',
  23. 'vue/no-v-html': 'off',
  24. 'no-unused-vars': 'off',
  25. 'vue/no-useless-template-attributes': 'off',
  26. 'use-isnan': 'off',
  27. 'vue/html-self-closing': [
  28. 'error',
  29. {
  30. html: {
  31. void: 'any',
  32. normal: 'any',
  33. component: 'always',
  34. },
  35. svg: 'always',
  36. math: 'always',
  37. },
  38. ],
  39. 'vue/component-name-in-template-casing': [
  40. 'error',
  41. 'kebab-case',
  42. {
  43. registeredComponentsOnly: false,
  44. ignores: [],
  45. },
  46. ],
  47. // 多字组件名称
  48. 'vue/multi-word-component-names': 'off',
  49. // Vue组件排序
  50. 'vue/order-in-components': [
  51. 'warn',
  52. {
  53. order: [
  54. 'el',
  55. 'name',
  56. 'key',
  57. 'parent',
  58. 'functional',
  59. ['delimiters', 'comments'],
  60. ['components', 'directives', 'filters'],
  61. 'extends',
  62. 'mixins',
  63. ['provide', 'inject'],
  64. 'ROUTER_GUARDS',
  65. 'layout',
  66. 'middleware',
  67. 'validate',
  68. 'scrollToTop',
  69. 'transition',
  70. 'loading',
  71. 'inheritAttrs',
  72. 'model',
  73. ['props', 'propsData'],
  74. 'emits',
  75. 'setup',
  76. 'fetch',
  77. 'asyncData',
  78. 'data',
  79. 'head',
  80. 'computed',
  81. 'watch',
  82. 'watchQuery',
  83. 'LIFECYCLE_HOOKS',
  84. 'methods',
  85. ['template', 'render'],
  86. 'renderError',
  87. ],
  88. },
  89. ],
  90. // Vue属性排序
  91. 'vue/attributes-order': [
  92. 'warn',
  93. {
  94. order: [
  95. 'DEFINITION',
  96. 'LIST_RENDERING',
  97. 'CONDITIONALS',
  98. 'RENDER_MODIFIERS',
  99. 'GLOBAL',
  100. 'UNIQUE',
  101. 'TWO_WAY_BINDING',
  102. 'OTHER_DIRECTIVES',
  103. 'OTHER_ATTR',
  104. 'EVENTS',
  105. 'CONTENT',
  106. ],
  107. alphabetical: true, //字母顺序
  108. },
  109. ],
  110. },
  111. parserOptions: {
  112. parser: 'babel-eslint',
  113. },
  114. overrides: [
  115. {
  116. files: ['**/__tests__/*.{j,t}s?(x)', '**/tests/unit/**/*.spec.{j,t}s?(x)'],
  117. env: {
  118. jest: true,
  119. },
  120. },
  121. ],
  122. }