.eslintrc.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. module.exports = {
  2. root: true,
  3. env: {
  4. browser: true,
  5. node: true,
  6. es6: true,
  7. },
  8. parser: "vue-eslint-parser",
  9. parserOptions: {
  10. parser: "@typescript-eslint/parser",
  11. ecmaVersion: 2020,
  12. sourceType: "module",
  13. jsxPragma: "React",
  14. ecmaFeatures: {
  15. jsx: true,
  16. tsx: true,
  17. },
  18. },
  19. plugins: ["@typescript-eslint", "prettier", "import"],
  20. extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:vue/vue3-recommended", "prettier"],
  21. overrides: [
  22. {
  23. files: ["*.ts", "*.tsx", "*.vue"],
  24. rules: {
  25. "no-undef": "off",
  26. },
  27. },
  28. ],
  29. rules: {
  30. "no-restricted-syntax": ["error", "LabeledStatement", "WithStatement"],
  31. camelcase: ["error", { properties: "never" }],
  32. "no-var": "error",
  33. "no-empty": ["error", { allowEmptyCatch: true }],
  34. "no-void": "error",
  35. "prefer-const": ["warn", { destructuring: "all", ignoreReadBeforeAssign: true }],
  36. "prefer-template": "error",
  37. "object-shorthand": ["error", "always", { ignoreConstructors: false, avoidQuotes: true }],
  38. "block-scoped-var": "error",
  39. "no-constant-condition": ["error", { checkLoops: false }],
  40. "no-redeclare": "off",
  41. "@typescript-eslint/no-redeclare": "error",
  42. "@typescript-eslint/ban-ts-comment": "off",
  43. "@typescript-eslint/ban-types": "off",
  44. "@typescript-eslint/explicit-module-boundary-types": "off",
  45. "@typescript-eslint/no-empty-function": "off",
  46. "@typescript-eslint/no-explicit-any": "off",
  47. "@typescript-eslint/no-non-null-assertion": "off",
  48. "@typescript-eslint/no-non-null-asserted-optional-chain": "off",
  49. "@typescript-eslint/no-var-requires": "off",
  50. "@typescript-eslint/no-unused-vars": [
  51. "error",
  52. {
  53. argsIgnorePattern: "^_",
  54. varsIgnorePattern: "^_",
  55. },
  56. ],
  57. "no-unused-vars": [
  58. "error",
  59. {
  60. argsIgnorePattern: "^_",
  61. varsIgnorePattern: "^_",
  62. },
  63. ],
  64. // vue
  65. "vue/no-v-html": "off",
  66. "vue/require-default-prop": "off",
  67. "vue/require-explicit-emits": "off",
  68. "vue/multi-word-component-names": "off",
  69. // prettier
  70. "prettier/prettier": "error",
  71. // import
  72. "import/first": "error",
  73. "import/no-duplicates": "error",
  74. "import/order": [
  75. "error",
  76. {
  77. groups: ["builtin", "external", "internal", "parent", "sibling", "index", "object", "type"],
  78. pathGroupsExcludedImportTypes: ["type"],
  79. },
  80. ],
  81. },
  82. }