.eslintrc.cjs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. // @ts-check
  2. const { defineConfig } = require("eslint-define-config");
  3. module.exports = defineConfig({
  4. root: true,
  5. env: {
  6. node: true
  7. },
  8. globals: {
  9. // Ref sugar (take 2)
  10. $: "readonly",
  11. $$: "readonly",
  12. $ref: "readonly",
  13. $shallowRef: "readonly",
  14. $computed: "readonly",
  15. // index.d.ts
  16. // global.d.ts
  17. Fn: "readonly",
  18. PromiseFn: "readonly",
  19. RefType: "readonly",
  20. LabelValueOptions: "readonly",
  21. EmitType: "readonly",
  22. TargetContext: "readonly",
  23. ComponentElRef: "readonly",
  24. ComponentRef: "readonly",
  25. ElRef: "readonly",
  26. global: "readonly",
  27. ForDataType: "readonly",
  28. ComponentRoutes: "readonly",
  29. // script setup
  30. defineProps: "readonly",
  31. defineEmits: "readonly",
  32. defineExpose: "readonly",
  33. withDefaults: "readonly"
  34. },
  35. extends: [
  36. "plugin:vue/vue3-essential",
  37. "eslint:recommended",
  38. "@vue/typescript/recommended",
  39. "@vue/prettier",
  40. "@vue/eslint-config-typescript"
  41. ],
  42. parser: "vue-eslint-parser",
  43. parserOptions: {
  44. parser: "@typescript-eslint/parser",
  45. ecmaVersion: "latest",
  46. sourceType: "module",
  47. jsxPragma: "React",
  48. ecmaFeatures: {
  49. jsx: true
  50. }
  51. },
  52. overrides: [
  53. {
  54. files: ["*.ts", "*.vue"],
  55. rules: {
  56. "no-undef": "off"
  57. }
  58. },
  59. {
  60. files: ["iconfont.js"],
  61. rules: {
  62. "no-var": "off",
  63. "prefer-const": "off"
  64. }
  65. },
  66. {
  67. files: ["*.vue"],
  68. parser: "vue-eslint-parser",
  69. parserOptions: {
  70. parser: "@typescript-eslint/parser",
  71. extraFileExtensions: [".vue"],
  72. ecmaVersion: "latest",
  73. ecmaFeatures: {
  74. jsx: true
  75. }
  76. },
  77. rules: {
  78. "no-undef": "off"
  79. }
  80. }
  81. ],
  82. rules: {
  83. "vue/no-v-html": "off",
  84. "vue/require-default-prop": "off",
  85. "vue/require-explicit-emits": "off",
  86. "vue/multi-word-component-names": "off",
  87. "@typescript-eslint/no-explicit-any": "off", // any
  88. "no-debugger": "off",
  89. "@typescript-eslint/explicit-module-boundary-types": "off", // setup()
  90. "@typescript-eslint/ban-types": "off",
  91. "@typescript-eslint/ban-ts-comment": "off",
  92. "@typescript-eslint/no-empty-function": "off",
  93. "@typescript-eslint/no-non-null-assertion": "off",
  94. "vue/html-self-closing": [
  95. "error",
  96. {
  97. html: {
  98. void: "always",
  99. normal: "always",
  100. component: "always"
  101. },
  102. svg: "always",
  103. math: "always"
  104. }
  105. ],
  106. "@typescript-eslint/no-unused-vars": [
  107. "error",
  108. {
  109. argsIgnorePattern: "^_",
  110. varsIgnorePattern: "^_"
  111. }
  112. ],
  113. "no-unused-vars": [
  114. "error",
  115. {
  116. argsIgnorePattern: "^_",
  117. varsIgnorePattern: "^_"
  118. }
  119. ],
  120. "prettier/prettier": [
  121. "error",
  122. {
  123. endOfLine: "auto"
  124. }
  125. ]
  126. }
  127. });