.eslintrc.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // @ts-check
  2. const {
  3. defineConfig
  4. } = require('eslint-define-config')
  5. module.exports = defineConfig({
  6. root: true,
  7. env: {
  8. browser: true,
  9. node: true,
  10. es6: true
  11. },
  12. parser: 'vue-eslint-parser',
  13. parserOptions: {
  14. parser: '@typescript-eslint/parser',
  15. ecmaVersion: 2020,
  16. sourceType: 'module',
  17. jsxPragma: 'React',
  18. ecmaFeatures: {
  19. jsx: true
  20. }
  21. },
  22. extends: [
  23. 'plugin:vue/vue3-recommended',
  24. 'plugin:@typescript-eslint/recommended',
  25. 'prettier',
  26. 'plugin:prettier/recommended',
  27. '@unocss'
  28. ],
  29. rules: {
  30. 'vue/no-setup-props-destructure': 'off',
  31. 'vue/script-setup-uses-vars': 'error',
  32. 'vue/no-reserved-component-names': 'off',
  33. '@typescript-eslint/ban-ts-ignore': 'off',
  34. '@typescript-eslint/explicit-function-return-type': 'off',
  35. '@typescript-eslint/no-explicit-any': 'off',
  36. '@typescript-eslint/no-var-requires': 'off',
  37. '@typescript-eslint/no-empty-function': 'off',
  38. 'vue/custom-event-name-casing': 'off',
  39. 'no-use-before-define': 'off',
  40. '@typescript-eslint/no-use-before-define': 'off',
  41. '@typescript-eslint/ban-ts-comment': 'off',
  42. '@typescript-eslint/ban-types': 'off',
  43. '@typescript-eslint/no-non-null-assertion': 'off',
  44. '@typescript-eslint/explicit-module-boundary-types': 'off',
  45. '@typescript-eslint/no-unused-vars': 'off',
  46. 'no-unused-vars': 'off',
  47. 'space-before-function-paren': 'off',
  48. 'vue/attributes-order': 'off',
  49. 'vue/one-component-per-file': 'off',
  50. 'vue/html-closing-bracket-newline': 'off',
  51. 'vue/max-attributes-per-line': 'off',
  52. 'vue/multiline-html-element-content-newline': 'off',
  53. 'vue/singleline-html-element-content-newline': 'off',
  54. 'vue/attribute-hyphenation': 'off',
  55. 'vue/require-default-prop': 'off',
  56. 'vue/require-explicit-emits': 'off',
  57. 'vue/require-toggle-inside-transition': 'off',
  58. 'vue/html-self-closing': [
  59. 'error',
  60. {
  61. html: {
  62. void: 'always',
  63. normal: 'never',
  64. component: 'always'
  65. },
  66. svg: 'always',
  67. math: 'always'
  68. }
  69. ],
  70. 'vue/multi-word-component-names': 'off',
  71. 'vue/no-v-html': 'off',
  72. 'prettier/prettier': 'off' // 非繁人:默认关闭 prettier 的 ESLint 校验,因为我们使用的是 IDE 的 Prettier 插件
  73. }
  74. })