.eslintrc.cjs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. // 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. // https://eslint.vuejs.org/rules/#priority-a-essential-error-prevention
  28. "vue/multi-word-component-names": "off",
  29. "vue/no-v-model-argument": "off",
  30. "vue/script-setup-uses-vars": "error",
  31. "vue/no-reserved-component-names": "off",
  32. "vue/custom-event-name-casing": "off",
  33. "vue/attributes-order": "off",
  34. "vue/one-component-per-file": "off",
  35. "vue/html-closing-bracket-newline": "off",
  36. "vue/max-attributes-per-line": "off",
  37. "vue/multiline-html-element-content-newline": "off",
  38. "vue/singleline-html-element-content-newline": "off",
  39. "vue/attribute-hyphenation": "off",
  40. "vue/require-default-prop": "off",
  41. "vue/require-explicit-emits": "off",
  42. "vue/html-self-closing": [
  43. "error",
  44. {
  45. html: {
  46. void: "always",
  47. normal: "never",
  48. component: "always",
  49. },
  50. svg: "always",
  51. math: "always",
  52. },
  53. ],
  54. "@typescript-eslint/no-empty-function": "off", // 关闭空方法检查
  55. "@typescript-eslint/no-explicit-any": "off", // 关闭any类型的警告
  56. "@typescript-eslint/no-non-null-assertion": "off",
  57. "@typescript-eslint/ban-ts-ignore": "off",
  58. "@typescript-eslint/ban-ts-comment": "off",
  59. "@typescript-eslint/ban-types": "off",
  60. "@typescript-eslint/explicit-function-return-type": "off",
  61. "@typescript-eslint/no-var-requires": "off",
  62. "@typescript-eslint/no-use-before-define": "off",
  63. "@typescript-eslint/explicit-module-boundary-types": "off",
  64. "@typescript-eslint/no-unused-vars": "off",
  65. "prettier/prettier": [
  66. "error",
  67. {
  68. useTabs: false, // 不使用制表符
  69. },
  70. ],
  71. },
  72. // eslint不能对html文件生效
  73. overrides: [
  74. {
  75. files: ["*.html"],
  76. processor: "vue/.vue",
  77. },
  78. ],
  79. // https://eslint.org/docs/latest/use/configure/language-options#specifying-globals
  80. globals: {
  81. OptionType: "readonly",
  82. },
  83. };