Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

253 строки
8.4 KiB

3 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
  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:import/errors",
  11. "plugin:import/warnings",
  12. "plugin:import/typescript",
  13. "prettier"
  14. ],
  15. "parser": "@typescript-eslint/parser",
  16. "parserOptions": {
  17. "ecmaVersion": 2019,
  18. "sourceType": "module",
  19. "ecmaFeatures": {
  20. "impliedStrict": true
  21. },
  22. "project": "tsconfig.json"
  23. },
  24. "plugins": ["import", "@typescript-eslint"],
  25. "reportUnusedDisableDirectives": true,
  26. "root": true,
  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-use-before-define": "off",
  65. "no-useless-call": "error",
  66. "no-useless-catch": "error",
  67. "no-useless-computed-key": "error",
  68. "no-useless-concat": "error",
  69. "no-useless-rename": "error",
  70. "no-useless-return": "error",
  71. "no-var": "error",
  72. "no-with": "error",
  73. "object-shorthand": ["error", "never"],
  74. "one-var": ["error", "never"],
  75. "prefer-arrow-callback": "error",
  76. "prefer-const": "error",
  77. "prefer-numeric-literals": "error",
  78. "prefer-object-spread": "error",
  79. "prefer-rest-params": "error",
  80. "prefer-spread": "error",
  81. "prefer-template": "error",
  82. "quotes": ["error", "single", { "avoidEscape": true }],
  83. // Turn off until fix for: https://github.com/eslint/eslint/issues/11899
  84. "require-atomic-updates": "off",
  85. "semi": ["error", "always"],
  86. "semi-style": ["error", "last"],
  87. "sort-imports": [
  88. "error",
  89. {
  90. "ignoreCase": true,
  91. "ignoreDeclarationSort": true,
  92. "ignoreMemberSort": false,
  93. "memberSyntaxSortOrder": ["none", "all", "multiple", "single"]
  94. }
  95. ],
  96. "yoda": "error",
  97. "import/export": "off",
  98. "import/extensions": ["error", "never"],
  99. "import/named": "off",
  100. "import/namespace": "off",
  101. "import/newline-after-import": "warn",
  102. "import/no-cycle": "off",
  103. "import/no-dynamic-require": "error",
  104. "import/no-default-export": "error",
  105. "import/no-duplicates": "error",
  106. "import/no-self-import": "error",
  107. "import/no-unresolved": ["warn", { "ignore": ["vscode"] }],
  108. "import/order": [
  109. "warn",
  110. {
  111. "groups": ["builtin", "external", "internal", ["index", "sibling", "parent"]],
  112. "newlines-between": "never"
  113. }
  114. ],
  115. "@typescript-eslint/ban-types": [
  116. "error",
  117. {
  118. "extendDefaults": false,
  119. "types": {
  120. "String": {
  121. "message": "Use string instead",
  122. "fixWith": "string"
  123. },
  124. "Boolean": {
  125. "message": "Use boolean instead",
  126. "fixWith": "boolean"
  127. },
  128. "Number": {
  129. "message": "Use number instead",
  130. "fixWith": "number"
  131. },
  132. "Symbol": {
  133. "message": "Use symbol instead",
  134. "fixWith": "symbol"
  135. },
  136. // "Function": {
  137. // "message": "The `Function` type accepts any function-like value.\nIt provides no type safety when calling the function, which can be a common source of bugs.\nIt also accepts things like class declarations, which will throw at runtime as they will not be called with `new`.\nIf you are expecting the function to accept certain arguments, you should explicitly define the function shape."
  138. // },
  139. "Object": {
  140. "message": "The `Object` type actually means \"any non-nullish value\", so it is marginally better than `unknown`.\n- If you want a type meaning \"any object\", you probably want `Record<string, unknown>` instead.\n- If you want a type meaning \"any value\", you probably want `unknown` instead."
  141. },
  142. "{}": {
  143. "message": "`{}` actually means \"any non-nullish value\".\n- If you want a type meaning \"any object\", you probably want `object` or `Record<string, unknown>` instead.\n- If you want a type meaning \"any value\", you probably want `unknown` instead.",
  144. "fixWith": "object"
  145. }
  146. // "object": {
  147. // "message": "The `object` type is currently hard to use ([see this issue](https://github.com/microsoft/TypeScript/issues/21732)).\nConsider using `Record<string, unknown>` instead, as it allows you to more easily inspect and use the keys."
  148. // }
  149. }
  150. }
  151. ],
  152. "@typescript-eslint/consistent-type-assertions": [
  153. "error",
  154. {
  155. "assertionStyle": "as",
  156. "objectLiteralTypeAssertions": "allow-as-parameter"
  157. }
  158. ],
  159. "@typescript-eslint/explicit-function-return-type": "off",
  160. "@typescript-eslint/explicit-member-accessibility": "off",
  161. "@typescript-eslint/explicit-module-boundary-types": "off", // TODO@eamodio revisit
  162. "@typescript-eslint/naming-convention": [
  163. "error",
  164. {
  165. "selector": "variable",
  166. "format": ["camelCase", "PascalCase"],
  167. "leadingUnderscore": "allow",
  168. "filter": {
  169. "regex": "^_$",
  170. "match": false
  171. }
  172. },
  173. {
  174. "selector": "variableLike",
  175. "format": ["camelCase"],
  176. "leadingUnderscore": "allow",
  177. "filter": {
  178. "regex": "^_$",
  179. "match": false
  180. }
  181. },
  182. {
  183. "selector": "memberLike",
  184. "modifiers": ["private"],
  185. "format": ["camelCase"],
  186. "leadingUnderscore": "allow"
  187. },
  188. {
  189. "selector": "memberLike",
  190. "modifiers": ["private", "readonly"],
  191. "format": ["camelCase", "PascalCase"],
  192. "leadingUnderscore": "allow"
  193. },
  194. {
  195. "selector": "memberLike",
  196. "modifiers": ["static", "readonly"],
  197. "format": ["camelCase", "PascalCase"]
  198. },
  199. {
  200. "selector": "interface",
  201. "format": ["PascalCase"],
  202. "custom": {
  203. "regex": "^I[A-Z]",
  204. "match": false
  205. }
  206. }
  207. ],
  208. "@typescript-eslint/no-empty-function": ["warn", { "allow": ["constructors"] }],
  209. "@typescript-eslint/no-empty-interface": "error",
  210. "@typescript-eslint/no-explicit-any": "off",
  211. "@typescript-eslint/no-floating-promises": "error",
  212. "@typescript-eslint/no-inferrable-types": ["warn", { "ignoreParameters": true, "ignoreProperties": true }],
  213. "@typescript-eslint/no-misused-promises": ["error", { "checksVoidReturn": false }],
  214. "@typescript-eslint/no-namespace": "off",
  215. "@typescript-eslint/no-non-null-assertion": "off",
  216. "@typescript-eslint/no-parameter-properties": "off",
  217. "@typescript-eslint/no-unnecessary-condition": "off",
  218. "@typescript-eslint/no-unsafe-assignment": "off", // TODO@eamodio revisit
  219. "@typescript-eslint/no-unsafe-call": "off", // TODO@eamodio revisit
  220. "@typescript-eslint/no-unsafe-member-access": "off", // TODO@eamodio revisit
  221. "@typescript-eslint/no-unsafe-return": "off", // TODO@eamodio revisit
  222. "@typescript-eslint/no-unused-expressions": ["warn", { "allowShortCircuit": true }],
  223. "@typescript-eslint/no-unused-vars": [
  224. "warn",
  225. {
  226. "args": "after-used",
  227. "argsIgnorePattern": "^_",
  228. "ignoreRestSiblings": true,
  229. "varsIgnorePattern": "^_$"
  230. }
  231. ],
  232. "@typescript-eslint/no-use-before-define": "off",
  233. "@typescript-eslint/prefer-nullish-coalescing": "off",
  234. "@typescript-eslint/prefer-optional-chain": "warn",
  235. "@typescript-eslint/restrict-template-expressions": [
  236. "error",
  237. { "allowAny": true, "allowBoolean": true, "allowNumber": true, "allowNullish": true }
  238. ],
  239. "@typescript-eslint/strict-boolean-expressions": [
  240. "warn",
  241. {
  242. "allowString": true,
  243. "allowNumber": true,
  244. "allowNullableObject": false,
  245. "allowNullableBoolean": true,
  246. "allowNullableNumber": true,
  247. "allowNullableString": true,
  248. "allowAny": false
  249. }
  250. ],
  251. "@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
  252. }
  253. }