.eslintrc.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. module.exports = {
  2. root: true,
  3. env: {
  4. node: true,
  5. es2020: true
  6. },
  7. extends: [
  8. 'plugin:vue/vue3-essential',
  9. '@vue/standard'
  10. ],
  11. parserOptions: {
  12. parser: '@typescript-eslint/parser',
  13. ecmaVersion: 2020,
  14. sourceType: 'module',
  15. requireConfigFile: false,
  16. ecmaFeatures: {
  17. jsx: true
  18. }
  19. },
  20. overrides: [
  21. {
  22. files: ['*.ts', '*.tsx', '*.vue'],
  23. parser: 'vue-eslint-parser',
  24. parserOptions: {
  25. parser: '@typescript-eslint/parser',
  26. ecmaVersion: 2020,
  27. sourceType: 'module'
  28. },
  29. rules: {
  30. '@typescript-eslint/no-unused-vars': 'off',
  31. '@typescript-eslint/no-explicit-any': 'off',
  32. '@typescript-eslint/explicit-module-boundary-types': 'off',
  33. '@typescript-eslint/no-non-null-assertion': 'off'
  34. }
  35. }
  36. ],
  37. rules: {
  38. // Vue 相关规则
  39. 'vue/multi-word-component-names': 'off',
  40. 'vue/no-deprecated-destroyed-lifecycle': 'off',
  41. 'vue/no-deprecated-slot-attribute': 'off',
  42. 'vue/no-v-for-template-key-on-child': 'off',
  43. 'vue/script-setup-uses-vars': 'error',
  44. // 基础规则
  45. indent: 'off',
  46. 'n/handle-callback-err': 'off',
  47. 'no-multiple-empty-lines': 'off',
  48. 'no-unreachable-loop': 'off',
  49. 'space-before-function-paren': 'off',
  50. 'eol-last': 'off',
  51. semi: 'off',
  52. 'unicode-bom': 'off',
  53. 'no-unused-vars': 'off',
  54. 'no-trailing-spaces': 'off',
  55. quotes: 'off',
  56. 'padded-blocks': 'off',
  57. 'comma-spacing': 'off',
  58. 'key-spacing': 'off',
  59. 'space-infix-ops': 'off',
  60. 'object-curly-spacing': 'off',
  61. 'arrow-spacing': 'off',
  62. 'no-undef': 'off',
  63. 'comma-dangle': 'off',
  64. 'multiline-ternary': 'off',
  65. 'spaced-comment': 'off',
  66. // TypeScript 相关规则
  67. '@typescript-eslint/space-infix-ops': 'off',
  68. '@typescript-eslint/no-unused-vars': 'off',
  69. '@typescript-eslint/no-explicit-any': 'off',
  70. '@typescript-eslint/explicit-module-boundary-types': 'off',
  71. '@typescript-eslint/no-non-null-assertion': 'off',
  72. // 导入相关规则 - 针对Vue组件中可能出现的重复导入问题
  73. 'import/no-duplicates': 'off',
  74. 'import/first': 'off',
  75. 'import/no-mutable-exports': 'off',
  76. // Vue Composition API 相关规则
  77. 'vue/no-setup-props-destructure': 'off',
  78. 'vue/require-default-prop': 'off',
  79. 'vue/require-prop-types': 'off',
  80. // HTML/Template 相关规则
  81. 'vue/html-closing-bracket-newline': 'off',
  82. 'vue/html-indent': 'off',
  83. 'vue/max-attributes-per-line': 'off',
  84. 'vue/singleline-html-element-content-newline': 'off',
  85. 'vue/multiline-html-element-content-newline': 'off',
  86. // 异步/Promise 相关规则
  87. 'prefer-promise-reject-errors': 'off',
  88. 'node/handle-callback-err': 'off'
  89. }
  90. }