.eslintrc.js 2.3 KB

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