.eslintrc.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. module.exports = {
  2. "env": {
  3. "browser": true,
  4. "es6": true,
  5. "node": true
  6. },
  7. "parser": "@typescript-eslint/parser",
  8. "parserOptions": {
  9. "project": "src/tsconfig.node.json",
  10. "sourceType": "module"
  11. },
  12. "plugins": [
  13. "@typescript-eslint",
  14. "import",
  15. "jsdoc",
  16. "prefer-arrow",
  17. "unicorn"
  18. ],
  19. "rules": {
  20. "@typescript-eslint/adjacent-overload-signatures": "error",
  21. "@typescript-eslint/array-type": [
  22. "error",
  23. {
  24. "default": "array"
  25. }
  26. ],
  27. "@typescript-eslint/await-thenable": "error",
  28. "@typescript-eslint/ban-ts-comment": "error",
  29. "@typescript-eslint/ban-types": "off",
  30. "@typescript-eslint/brace-style": [
  31. "error",
  32. "1tbs",
  33. {
  34. "allowSingleLine": true
  35. }
  36. ],
  37. "@typescript-eslint/camelcase": "off",
  38. "@typescript-eslint/comma-spacing": "error",
  39. "@typescript-eslint/consistent-type-assertions": [
  40. "error",
  41. {
  42. "assertionStyle": "angle-bracket"
  43. }
  44. ],
  45. "@typescript-eslint/consistent-type-definitions": "error",
  46. "@typescript-eslint/default-param-last": "error",
  47. "@typescript-eslint/explicit-function-return-type": "error",
  48. "@typescript-eslint/explicit-member-accessibility": [
  49. "error",
  50. {
  51. "accessibility": "explicit"
  52. }
  53. ],
  54. "@typescript-eslint/explicit-module-boundary-types": "error",
  55. "@typescript-eslint/func-call-spacing": "error",
  56. "@typescript-eslint/indent": [
  57. "off",
  58. 4
  59. ],
  60. "@typescript-eslint/member-delimiter-style": [
  61. "error",
  62. {
  63. "multiline": {
  64. "delimiter": "semi",
  65. "requireLast": true
  66. },
  67. "singleline": {
  68. "delimiter": "semi",
  69. "requireLast": false
  70. }
  71. }
  72. ],
  73. "@typescript-eslint/member-ordering": "error",
  74. "@typescript-eslint/naming-convention": [
  75. "error",
  76. {
  77. "selector": "default",
  78. "format": ["camelCase", "PascalCase"]
  79. },
  80. {
  81. "selector": "variable",
  82. "format": ["camelCase", "PascalCase", "UPPER_CASE"]
  83. },
  84. {
  85. "selector": "function",
  86. "format": ["camelCase", "PascalCase"]
  87. },
  88. {
  89. "selector": "class",
  90. "format": ["PascalCase"]
  91. },
  92. {
  93. "selector": "interface",
  94. "format": ["PascalCase"],
  95. "prefix": ["I"]
  96. },
  97. {
  98. "selector": "typeAlias",
  99. "format": ["PascalCase"],
  100. "prefix": ["T"]
  101. },
  102. {
  103. "selector": "typeParameter",
  104. "format": ["PascalCase"]
  105. },
  106. {
  107. "selector": "enum",
  108. "format": ["PascalCase"]
  109. },
  110. {
  111. "selector": "enumMember",
  112. "format": null
  113. },
  114. {
  115. "selector": "property",
  116. "format": ["camelCase", "PascalCase", "snake_case"]
  117. }
  118. ],
  119. "@typescript-eslint/no-empty-function": "off",
  120. "@typescript-eslint/no-empty-interface": "error",
  121. "@typescript-eslint/no-explicit-any": "off",
  122. "@typescript-eslint/no-extra-parens": "off",
  123. "@typescript-eslint/no-floating-promises": "error",
  124. "@typescript-eslint/no-for-in-array": "error",
  125. "@typescript-eslint/no-inferrable-types": "off",
  126. "@typescript-eslint/no-magic-numbers": "off",
  127. "@typescript-eslint/no-misused-new": "error",
  128. "@typescript-eslint/no-namespace": "error",
  129. "@typescript-eslint/no-non-null-asserted-optional-chain": "error",
  130. "@typescript-eslint/no-non-null-assertion": "error",
  131. "@typescript-eslint/no-param-reassign": "off",
  132. "@typescript-eslint/no-parameter-properties": "error",
  133. "@typescript-eslint/no-require-imports": "off",
  134. "@typescript-eslint/no-shadow": "error",
  135. "@typescript-eslint/no-this-alias": "error",
  136. "@typescript-eslint/no-unnecessary-qualifier": "error",
  137. "@typescript-eslint/no-unnecessary-type-arguments": "error",
  138. "@typescript-eslint/no-unnecessary-type-assertion": "error",
  139. "@typescript-eslint/no-unused-expressions": "error",
  140. "@typescript-eslint/no-use-before-define": "off",
  141. "@typescript-eslint/no-var-requires": "error",
  142. "@typescript-eslint/prefer-for-of": "error",
  143. "@typescript-eslint/prefer-function-type": "error",
  144. "@typescript-eslint/prefer-namespace-keyword": "error",
  145. "@typescript-eslint/prefer-nullish-coalescing": "error",
  146. "@typescript-eslint/prefer-optional-chain": "error",
  147. "@typescript-eslint/prefer-readonly": "error",
  148. "@typescript-eslint/promise-function-async": "error",
  149. "@typescript-eslint/quotes": [
  150. "error",
  151. "single"
  152. ],
  153. "@typescript-eslint/require-array-sort-compare": "error",
  154. "@typescript-eslint/restrict-plus-operands": "error",
  155. "@typescript-eslint/semi": [
  156. "error",
  157. "always"
  158. ],
  159. "@typescript-eslint/space-before-function-paren": "error",
  160. "@typescript-eslint/strict-boolean-expressions": "off",
  161. "@typescript-eslint/triple-slash-reference": "error",
  162. "@typescript-eslint/type-annotation-spacing": "error",
  163. "@typescript-eslint/typedef": "error",
  164. "@typescript-eslint/unified-signatures": "error",
  165. "arrow-body-style": "off",
  166. "arrow-parens": [
  167. "off",
  168. "as-needed"
  169. ],
  170. "brace-style": "off",
  171. "capitalized-comments": "off",
  172. "comma-dangle": "off",
  173. "comma-spacing": "off",
  174. "complexity": [
  175. "error",
  176. {
  177. "max": 10
  178. }
  179. ],
  180. "constructor-super": "error",
  181. "curly": "error",
  182. "default-case": "off",
  183. "dot-notation": "error",
  184. "eol-last": "error",
  185. "eqeqeq": [
  186. "error",
  187. "smart"
  188. ],
  189. "func-call-spacing": "off",
  190. "guard-for-in": "error",
  191. "id-blacklist": "off",
  192. "id-match": "off",
  193. "import/export": "error",
  194. "import/first": "error",
  195. "import/newline-after-import": "error",
  196. "import/no-absolute-path": "error",
  197. "import/no-cycle": "error",
  198. "import/no-default-export": "error",
  199. "import/no-deprecated": "error",
  200. "import/no-extraneous-dependencies": "error",
  201. "import/no-internal-modules": "error",
  202. "import/no-mutable-exports": "error",
  203. "import/no-unassigned-import": "off",
  204. "import/no-useless-path-segments": "error",
  205. "import/order": "off",
  206. "indent": "off",
  207. "jsdoc/no-types": "off",
  208. "linebreak-style": "off",
  209. "max-classes-per-file": [
  210. "error",
  211. 1
  212. ],
  213. "max-len": "off",
  214. "max-lines": [
  215. "error",
  216. 500
  217. ],
  218. "new-parens": "error",
  219. "newline-per-chained-call": "off",
  220. "no-bitwise": "off",
  221. "no-caller": "error",
  222. "no-cond-assign": "error",
  223. "no-console": [
  224. "error",
  225. {
  226. "allow": [
  227. "log",
  228. "warn",
  229. "dir",
  230. "timeLog",
  231. "assert",
  232. "clear",
  233. "count",
  234. "countReset",
  235. "group",
  236. "groupEnd",
  237. "table",
  238. "dirxml",
  239. "error",
  240. "groupCollapsed",
  241. "Console",
  242. "profile",
  243. "profileEnd",
  244. "timeStamp",
  245. "context"
  246. ]
  247. }
  248. ],
  249. "no-constant-condition": "error",
  250. "no-control-regex": "off",
  251. "no-debugger": "error",
  252. "no-duplicate-case": "error",
  253. "no-duplicate-imports": "error",
  254. "no-empty": "off",
  255. "no-eval": "off",
  256. "no-extra-bind": "error",
  257. "no-extra-parens": "off",
  258. "no-extra-semi": "error",
  259. "no-fallthrough": "error",
  260. "no-invalid-regexp": "error",
  261. "no-invalid-this": "off",
  262. "no-irregular-whitespace": "error",
  263. "no-magic-numbers": "off",
  264. "no-multi-str": "error",
  265. "no-multiple-empty-lines": "error",
  266. "no-new-wrappers": "error",
  267. "no-null/no-null": "off",
  268. "no-octal": "error",
  269. "no-octal-escape": "error",
  270. "no-redeclare": "error",
  271. "no-regex-spaces": "error",
  272. "no-restricted-syntax": [
  273. "error",
  274. "ForInStatement"
  275. ],
  276. "no-return-await": "error",
  277. "no-sequences": "error",
  278. "no-shadow": "off",
  279. "no-sparse-arrays": "error",
  280. "no-template-curly-in-string": "error",
  281. "no-throw-literal": "error",
  282. "no-trailing-spaces": [
  283. "error",
  284. {
  285. "skipBlankLines": true
  286. }
  287. ],
  288. "no-undef-init": "error",
  289. "no-underscore-dangle": "off",
  290. "no-unsafe-finally": "error",
  291. "no-unused-expressions": "off",
  292. "no-unused-labels": "error",
  293. "no-var": "error",
  294. "no-void": "error",
  295. "object-shorthand": "off",
  296. "one-var": [
  297. "error",
  298. "never"
  299. ],
  300. "padding-line-between-statements": [
  301. "error",
  302. {
  303. "blankLine": "always",
  304. "prev": "*",
  305. "next": "return"
  306. }
  307. ],
  308. "prefer-arrow/prefer-arrow-functions": "off",
  309. "prefer-const": "error",
  310. "prefer-object-spread": "error",
  311. "prefer-template": "error",
  312. "quote-props": [
  313. "error",
  314. "as-needed"
  315. ],
  316. "quotes": "off",
  317. "radix": "error",
  318. "space-before-function-paren": "off",
  319. "spaced-comment": "error",
  320. "space-in-parens": [
  321. "error",
  322. "never"
  323. ],
  324. "unicorn/catch-error-name": [
  325. "error",
  326. {
  327. "name": "error"
  328. }
  329. ],
  330. "unicorn/no-nested-ternary": "error",
  331. "unicorn/no-unreadable-array-destructuring": "error",
  332. "unicorn/numeric-separators-style": [
  333. "error",
  334. {
  335. number: {
  336. minimumDigits: 7,
  337. groupLength: 3
  338. }
  339. }
  340. ],
  341. "unicorn/prefer-array-find": "error",
  342. "unicorn/prefer-includes": "error",
  343. "unicorn/prefer-optional-catch-binding": "error",
  344. "unicorn/prefer-starts-ends-with": "error",
  345. "unicorn/prefer-set-has": "error",
  346. "unicorn/prefer-string-slice": "error",
  347. "unicorn/prefer-string-trim-start-end": "error",
  348. "use-isnan": "error",
  349. "valid-typeof": "error",
  350. "yoda": "error"
  351. }
  352. };