.eslintrc.js 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  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": "error",
  30. "@typescript-eslint/brace-style": [
  31. "error",
  32. "1tbs",
  33. {
  34. "allowSingleLine": true
  35. }
  36. ],
  37. "@typescript-eslint/camelcase": "off",
  38. "@typescript-eslint/class-name-casing": "error",
  39. "@typescript-eslint/comma-spacing": "error",
  40. "@typescript-eslint/consistent-type-assertions": [
  41. "error",
  42. {
  43. "assertionStyle": "angle-bracket"
  44. }
  45. ],
  46. "@typescript-eslint/consistent-type-definitions": "error",
  47. "@typescript-eslint/default-param-last": "error",
  48. "@typescript-eslint/explicit-function-return-type": "error",
  49. "@typescript-eslint/explicit-member-accessibility": [
  50. "error",
  51. {
  52. "accessibility": "explicit"
  53. }
  54. ],
  55. "@typescript-eslint/explicit-module-boundary-types": "error",
  56. "@typescript-eslint/func-call-spacing": "error",
  57. "@typescript-eslint/indent": [
  58. "off",
  59. 4
  60. ],
  61. "@typescript-eslint/interface-name-prefix": [
  62. "error",
  63. "always"
  64. ],
  65. "@typescript-eslint/member-delimiter-style": [
  66. "error",
  67. {
  68. "multiline": {
  69. "delimiter": "semi",
  70. "requireLast": true
  71. },
  72. "singleline": {
  73. "delimiter": "semi",
  74. "requireLast": false
  75. }
  76. }
  77. ],
  78. "@typescript-eslint/member-ordering": "error",
  79. "@typescript-eslint/no-empty-function": "off",
  80. "@typescript-eslint/no-empty-interface": "error",
  81. "@typescript-eslint/no-explicit-any": "off",
  82. "@typescript-eslint/no-extra-parens": "off",
  83. "@typescript-eslint/no-floating-promises": "error",
  84. "@typescript-eslint/no-for-in-array": "error",
  85. "@typescript-eslint/no-inferrable-types": "off",
  86. "@typescript-eslint/no-magic-numbers": "off",
  87. "@typescript-eslint/no-misused-new": "error",
  88. "@typescript-eslint/no-namespace": "error",
  89. "@typescript-eslint/no-non-null-asserted-optional-chain": "error",
  90. "@typescript-eslint/no-non-null-assertion": "error",
  91. "@typescript-eslint/no-param-reassign": "off",
  92. "@typescript-eslint/no-parameter-properties": "error",
  93. "@typescript-eslint/no-require-imports": "off",
  94. "@typescript-eslint/no-this-alias": "error",
  95. "@typescript-eslint/no-unnecessary-qualifier": "error",
  96. "@typescript-eslint/no-unnecessary-type-arguments": "error",
  97. "@typescript-eslint/no-unnecessary-type-assertion": "error",
  98. "@typescript-eslint/no-unused-expressions": "error",
  99. "@typescript-eslint/no-use-before-define": "off",
  100. "@typescript-eslint/no-var-requires": "error",
  101. "@typescript-eslint/prefer-for-of": "error",
  102. "@typescript-eslint/prefer-function-type": "error",
  103. "@typescript-eslint/prefer-namespace-keyword": "error",
  104. "@typescript-eslint/prefer-nullish-coalescing": "error",
  105. "@typescript-eslint/prefer-optional-chain": "error",
  106. "@typescript-eslint/prefer-readonly": "error",
  107. "@typescript-eslint/promise-function-async": "error",
  108. "@typescript-eslint/quotes": [
  109. "error",
  110. "single"
  111. ],
  112. "@typescript-eslint/require-array-sort-compare": "error",
  113. "@typescript-eslint/restrict-plus-operands": "error",
  114. "@typescript-eslint/semi": [
  115. "error",
  116. "always"
  117. ],
  118. "@typescript-eslint/space-before-function-paren": "error",
  119. "@typescript-eslint/strict-boolean-expressions": "off",
  120. "@typescript-eslint/triple-slash-reference": "error",
  121. "@typescript-eslint/type-annotation-spacing": "error",
  122. "@typescript-eslint/typedef": "error",
  123. "@typescript-eslint/unified-signatures": "error",
  124. "arrow-body-style": "off",
  125. "arrow-parens": [
  126. "off",
  127. "as-needed"
  128. ],
  129. "brace-style": "off",
  130. "capitalized-comments": "off",
  131. "comma-dangle": "off",
  132. "comma-spacing": "off",
  133. "complexity": [
  134. "error",
  135. {
  136. "max": 10
  137. }
  138. ],
  139. "constructor-super": "error",
  140. "curly": "error",
  141. "default-case": "off",
  142. "dot-notation": "error",
  143. "eol-last": "error",
  144. "eqeqeq": [
  145. "error",
  146. "smart"
  147. ],
  148. "func-call-spacing": "off",
  149. "guard-for-in": "error",
  150. "id-blacklist": "off",
  151. "id-match": "off",
  152. "import/no-default-export": "error",
  153. "import/no-deprecated": "error",
  154. "import/no-extraneous-dependencies": "error",
  155. "import/no-internal-modules": "error",
  156. "import/no-unassigned-import": "off",
  157. "import/order": "off",
  158. "indent": "off",
  159. "jsdoc/no-types": "off",
  160. "linebreak-style": "error",
  161. "max-classes-per-file": [
  162. "error",
  163. 1
  164. ],
  165. "max-len": "off",
  166. "max-lines": [
  167. "error",
  168. 500
  169. ],
  170. "new-parens": "error",
  171. "newline-per-chained-call": "off",
  172. "no-bitwise": "off",
  173. "no-caller": "error",
  174. "no-cond-assign": "error",
  175. "no-console": [
  176. "error",
  177. {
  178. "allow": [
  179. "log",
  180. "warn",
  181. "dir",
  182. "timeLog",
  183. "assert",
  184. "clear",
  185. "count",
  186. "countReset",
  187. "group",
  188. "groupEnd",
  189. "table",
  190. "dirxml",
  191. "error",
  192. "groupCollapsed",
  193. "Console",
  194. "profile",
  195. "profileEnd",
  196. "timeStamp",
  197. "context"
  198. ]
  199. }
  200. ],
  201. "no-constant-condition": "error",
  202. "no-control-regex": "off",
  203. "no-debugger": "error",
  204. "no-duplicate-case": "error",
  205. "no-duplicate-imports": "error",
  206. "no-empty": "off",
  207. "no-eval": "off",
  208. "no-extra-bind": "error",
  209. "no-extra-parens": "off",
  210. "no-extra-semi": "error",
  211. "no-fallthrough": "error",
  212. "no-invalid-regexp": "error",
  213. "no-invalid-this": "off",
  214. "no-irregular-whitespace": "error",
  215. "no-magic-numbers": "off",
  216. "no-multi-str": "error",
  217. "no-multiple-empty-lines": "error",
  218. "no-new-wrappers": "error",
  219. "no-null/no-null": "off",
  220. "no-octal": "error",
  221. "no-octal-escape": "error",
  222. "no-redeclare": "error",
  223. "no-regex-spaces": "error",
  224. "no-restricted-syntax": [
  225. "error",
  226. "ForInStatement"
  227. ],
  228. "no-return-await": "error",
  229. "no-sequences": "error",
  230. "no-shadow": [
  231. "error",
  232. {
  233. "hoist": "all"
  234. }
  235. ],
  236. "no-sparse-arrays": "error",
  237. "no-template-curly-in-string": "error",
  238. "no-throw-literal": "error",
  239. "no-trailing-spaces": [
  240. "error",
  241. {
  242. "skipBlankLines": true
  243. }
  244. ],
  245. "no-undef-init": "error",
  246. "no-underscore-dangle": "off",
  247. "no-unsafe-finally": "error",
  248. "no-unused-expressions": "off",
  249. "no-unused-labels": "error",
  250. "no-var": "error",
  251. "no-void": "error",
  252. "object-shorthand": "off",
  253. "one-var": [
  254. "error",
  255. "never"
  256. ],
  257. "padding-line-between-statements": [
  258. "error",
  259. {
  260. "blankLine": "always",
  261. "prev": "*",
  262. "next": "return"
  263. }
  264. ],
  265. "prefer-arrow/prefer-arrow-functions": "off",
  266. "prefer-const": "error",
  267. "prefer-object-spread": "error",
  268. "prefer-template": "error",
  269. "quote-props": [
  270. "error",
  271. "as-needed"
  272. ],
  273. "quotes": "off",
  274. "radix": "error",
  275. "space-before-function-paren": "off",
  276. "spaced-comment": "error",
  277. "space-in-parens": [
  278. "error",
  279. "never"
  280. ],
  281. "unicorn/catch-error-name": [
  282. "error",
  283. {
  284. "name": "error"
  285. }
  286. ],
  287. "unicorn/no-array-instanceof": "error",
  288. "unicorn/no-nested-ternary": "error",
  289. "unicorn/no-unreadable-array-destructuring": "error",
  290. "unicorn/prefer-includes": "error",
  291. "unicorn/prefer-starts-ends-with": "error",
  292. "unicorn/prefer-trim-start-end": "error",
  293. "use-isnan": "error",
  294. "valid-typeof": "error",
  295. "yoda": "error"
  296. }
  297. };