.eslintrc.cjs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. module.exports = {
  2. //root: true,
  3. env: {
  4. browser: true,
  5. es2021: true,
  6. node: true,
  7. },
  8. parser: "vue-eslint-parser",
  9. extends: [
  10. // 参考vuejs官方的eslint配置: https://eslint.vuejs.org/user-guide/#usage
  11. "plugin:vue/vue3-recommended",
  12. "./.eslintrc-auto-import.json",
  13. "prettier",
  14. "plugin:@typescript-eslint/recommended",
  15. "plugin:prettier/recommended",
  16. ],
  17. parserOptions: {
  18. ecmaVersion: "latest",
  19. sourceType: "module",
  20. parser: "@typescript-eslint/parser",
  21. // project: "./tsconfig.*?.json",
  22. // createDefaultProgram: false,
  23. // extraFileExtensions: [".vue"],
  24. },
  25. plugins: ["vue", "@typescript-eslint"],
  26. rules: {
  27. "vue/multi-word-component-names": "off", // 关闭组件名必须多字: https://eslint.vuejs.org/rules/multi-word-component-names.html
  28. "@typescript-eslint/no-empty-function": "off", // 关闭空方法检查
  29. "@typescript-eslint/no-explicit-any": "off", // 关闭any类型的警告
  30. "vue/no-v-model-argument": "off",
  31. "@typescript-eslint/no-non-null-assertion": "off",
  32. "@typescript-eslint/ban-ts-ignore": "off",
  33. "@typescript-eslint/ban-ts-comment": "off",
  34. "@typescript-eslint/ban-types": "off",
  35. "@typescript-eslint/explicit-function-return-type": "off",
  36. "@typescript-eslint/no-explicit-any": "off",
  37. "@typescript-eslint/no-var-requires": "off",
  38. "@typescript-eslint/no-empty-function": "off",
  39. "@typescript-eslint/no-use-before-define": "off",
  40. "@typescript-eslint/no-non-null-assertion": "off",
  41. "@typescript-eslint/explicit-module-boundary-types": "off",
  42. "vue/script-setup-uses-vars": "error",
  43. "vue/no-reserved-component-names": "off",
  44. "vue/custom-event-name-casing": "off",
  45. "vue/attributes-order": "off",
  46. "vue/one-component-per-file": "off",
  47. "vue/html-closing-bracket-newline": "off",
  48. "vue/max-attributes-per-line": "off",
  49. "vue/multiline-html-element-content-newline": "off",
  50. "vue/singleline-html-element-content-newline": "off",
  51. "vue/attribute-hyphenation": "off",
  52. "vue/require-default-prop": "off",
  53. "vue/require-explicit-emits": "off",
  54. "vue/html-self-closing": [
  55. "error",
  56. {
  57. html: {
  58. void: "always",
  59. normal: "never",
  60. component: "always",
  61. },
  62. svg: "always",
  63. math: "always",
  64. },
  65. ],
  66. "vue/multi-word-component-names": "off",
  67. },
  68. // eslint不能对html文件生效
  69. overrides: [
  70. {
  71. files: ["*.html"],
  72. processor: "vue/.vue",
  73. },
  74. ],
  75. // https://eslint.org/docs/latest/use/configure/language-options#specifying-globals
  76. globals: {
  77. DialogOption: "readonly",
  78. OptionType: "readonly",
  79. },
  80. };