您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

138 行
5.5 KiB

  1. {
  2. "env": {
  3. "es6": true,
  4. "node": true
  5. },
  6. "extends": [
  7. "eslint:recommended",
  8. "plugin:@typescript-eslint/recommended",
  9. "plugin:@typescript-eslint/recommended-requiring-type-checking",
  10. "plugin:@typescript-eslint/eslint-recommended",
  11. "plugin:import/errors",
  12. "plugin:import/warnings",
  13. "plugin:import/typescript",
  14. "prettier",
  15. "prettier/@typescript-eslint"
  16. ],
  17. "parser": "@typescript-eslint/parser",
  18. "parserOptions": {
  19. "ecmaVersion": 2018,
  20. "sourceType": "module",
  21. "ecmaFeatures": {
  22. "impliedStrict": true
  23. },
  24. "project": "tsconfig.eslint.json"
  25. },
  26. "plugins": ["import", "prettiest", "@typescript-eslint"],
  27. "rules": {
  28. "arrow-parens": ["off"],
  29. "brace-style": ["off", "stroustrup"],
  30. "consistent-return": "error",
  31. "curly": ["error", "multi-line", "consistent"],
  32. "eol-last": "error",
  33. "linebreak-style": ["error", "unix"],
  34. "new-parens": "error",
  35. "no-console": "off",
  36. "no-constant-condition": ["warn", { "checkLoops": false }],
  37. "no-caller": "error",
  38. "no-debugger": "warn",
  39. "no-dupe-class-members": "off",
  40. "no-duplicate-imports": "error",
  41. "no-else-return": "warn",
  42. "no-empty": ["warn", { "allowEmptyCatch": true }],
  43. "no-eval": "error",
  44. "no-ex-assign": "warn",
  45. "no-extend-native": "error",
  46. "no-extra-bind": "error",
  47. "no-floating-decimal": "error",
  48. "no-implicit-coercion": "error",
  49. "no-implied-eval": "error",
  50. // Turn off until fix for: https://github.com/typescript-eslint/typescript-eslint/issues/239
  51. "no-inner-declarations": "off",
  52. "no-lone-blocks": "error",
  53. "no-lonely-if": "error",
  54. "no-loop-func": "error",
  55. "no-multi-spaces": "error",
  56. "no-return-assign": "error",
  57. "no-return-await": "warn",
  58. "no-self-compare": "error",
  59. "no-sequences": "error",
  60. "no-template-curly-in-string": "warn",
  61. "no-throw-literal": "error",
  62. "no-unmodified-loop-condition": "warn",
  63. "no-unneeded-ternary": "error",
  64. "no-unused-expressions": ["warn", { "allowShortCircuit": true }],
  65. "no-use-before-define": "off",
  66. "no-useless-call": "error",
  67. "no-useless-catch": "error",
  68. "no-useless-computed-key": "error",
  69. "no-useless-concat": "error",
  70. "no-useless-rename": "error",
  71. "no-useless-return": "error",
  72. "no-var": "error",
  73. "no-with": "error",
  74. "object-shorthand": ["error", "never"],
  75. "one-var": ["error", "never"],
  76. "prefer-arrow-callback": "error",
  77. "prefer-const": "error",
  78. "prefer-numeric-literals": "error",
  79. "prefer-object-spread": "error",
  80. "prefer-rest-params": "error",
  81. "prefer-spread": "error",
  82. "prefer-template": "error",
  83. "quotes": ["error", "single", { "avoidEscape": true }],
  84. // Turn off until fix for: https://github.com/eslint/eslint/issues/11899
  85. "require-atomic-updates": "off",
  86. "semi": ["error", "always"],
  87. "semi-style": ["error", "last"],
  88. "sort-imports": [
  89. "error",
  90. {
  91. "ignoreCase": true,
  92. "ignoreDeclarationSort": true,
  93. "ignoreMemberSort": false,
  94. "memberSyntaxSortOrder": ["none", "all", "multiple", "single"]
  95. }
  96. ],
  97. "yoda": "error",
  98. "import/export": "off",
  99. "import/extensions": ["error", "never"],
  100. "import/named": "off",
  101. "import/namespace": "off",
  102. "import/newline-after-import": "warn",
  103. "import/no-cycle": "off",
  104. "import/no-dynamic-require": "error",
  105. "import/no-default-export": "error",
  106. "import/no-duplicates": "error",
  107. "import/no-self-import": "error",
  108. "import/no-unresolved": ["warn", { "ignore": ["vscode"] }],
  109. "import/order": [
  110. "warn",
  111. {
  112. "groups": ["builtin", "external", "internal", ["index", "sibling", "parent"]],
  113. "newlines-between": "never"
  114. }
  115. ],
  116. "prettiest/no-block-after-closing": "error",
  117. "@typescript-eslint/consistent-type-assertions": [
  118. "error",
  119. {
  120. "assertionStyle": "as",
  121. "objectLiteralTypeAssertions": "allow-as-parameter"
  122. }
  123. ],
  124. "@typescript-eslint/explicit-function-return-type": "off",
  125. "@typescript-eslint/explicit-member-accessibility": "off",
  126. "@typescript-eslint/no-empty-function": ["warn", { "allow": ["constructors"] }],
  127. "@typescript-eslint/no-empty-interface": "off",
  128. "@typescript-eslint/no-explicit-any": "off",
  129. "@typescript-eslint/no-inferrable-types": ["warn", { "ignoreParameters": true, "ignoreProperties": true }],
  130. "@typescript-eslint/no-misused-promises": ["error", { "checksVoidReturn": false }],
  131. "@typescript-eslint/no-namespace": "off",
  132. "@typescript-eslint/no-non-null-assertion": "off",
  133. "@typescript-eslint/no-parameter-properties": "off",
  134. "@typescript-eslint/no-unused-vars": ["warn", { "args": "none" }],
  135. "@typescript-eslint/no-use-before-define": "off",
  136. "@typescript-eslint/unbound-method": "off" // Too many bugs right now: https://github.com/typescript-eslint/typescript-eslint/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+unbound-method
  137. }
  138. }