.eslintrc.cjs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* eslint-env node */
  2. require('@rushstack/eslint-patch/modern-module-resolution')
  3. module.exports = {
  4. root: true,
  5. extends: [
  6. 'plugin:vue/vue3-essential',
  7. 'eslint:recommended',
  8. '@vue/eslint-config-typescript',
  9. '@vue/eslint-config-prettier/skip-formatting',
  10. 'plugin:prettier/recommended'
  11. ],
  12. parserOptions: {
  13. ecmaVersion: 'latest'
  14. },
  15. rules: {
  16. // Vue
  17. 'vue/no-v-html': 'off',
  18. 'vue/require-default-prop': 'off',
  19. 'vue/require-explicit-emits': 'off',
  20. 'vue/multi-word-component-names': [
  21. 'error',
  22. {
  23. ignores: ['index', 'main'] //需要忽略的组件名
  24. }
  25. ],
  26. 'vue/html-self-closing': [
  27. 'error',
  28. {
  29. html: {
  30. void: 'always',
  31. normal: 'always',
  32. component: 'always'
  33. },
  34. svg: 'always',
  35. math: 'always'
  36. }
  37. ],
  38. 'vue/attributes-order': [
  39. 'warn',
  40. {
  41. order: [
  42. 'DEFINITION',
  43. 'LIST_RENDERING',
  44. 'CONDITIONALS',
  45. 'RENDER_MODIFIERS',
  46. 'GLOBAL',
  47. 'UNIQUE',
  48. 'TWO_WAY_BINDING',
  49. 'OTHER_DIRECTIVES',
  50. 'OTHER_ATTR',
  51. 'EVENTS',
  52. 'CONTENT'
  53. ],
  54. alphabetical: true //字母顺序
  55. }
  56. ]
  57. }
  58. }