@nr1e/commons 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (440) hide show
  1. package/.editorconfig +19 -0
  2. package/.eslintignore +3 -0
  3. package/.eslintrc.json +4 -0
  4. package/.git/COMMIT_EDITMSG +5 -0
  5. package/.git/FETCH_HEAD +1 -0
  6. package/.git/HEAD +1 -0
  7. package/.git/config +18 -0
  8. package/.git/config.worktree +5 -0
  9. package/.git/description +1 -0
  10. package/.git/hooks/applypatch-msg.sample +15 -0
  11. package/.git/hooks/commit-msg.sample +24 -0
  12. package/.git/hooks/fsmonitor-watchman.sample +174 -0
  13. package/.git/hooks/post-update.sample +8 -0
  14. package/.git/hooks/pre-applypatch.sample +14 -0
  15. package/.git/hooks/pre-commit.sample +49 -0
  16. package/.git/hooks/pre-merge-commit.sample +13 -0
  17. package/.git/hooks/pre-push.sample +53 -0
  18. package/.git/hooks/pre-rebase.sample +169 -0
  19. package/.git/hooks/pre-receive.sample +24 -0
  20. package/.git/hooks/prepare-commit-msg.sample +42 -0
  21. package/.git/hooks/push-to-checkout.sample +78 -0
  22. package/.git/hooks/sendemail-validate.sample +77 -0
  23. package/.git/hooks/update.sample +128 -0
  24. package/.git/index +0 -0
  25. package/.git/info/exclude +6 -0
  26. package/.git/logs/HEAD +2 -0
  27. package/.git/logs/refs/heads/main +2 -0
  28. package/.git/logs/refs/remotes/origin/main +2 -0
  29. package/.git/objects/07/c0af7cd711cab6a55ad3dc349ac8c70775623c +0 -0
  30. package/.git/objects/0d/698432e2c44311c17b845cc63093a898972b95 +0 -0
  31. package/.git/objects/10/ba4a7d64968326293182d571a9c73f5e041fb6 +3 -0
  32. package/.git/objects/12/069a5aa45479564e00749f730582627a276a55 +3 -0
  33. package/.git/objects/14/5ab9cf82c40696a07ab42f117ba199acb2a50b +4 -0
  34. package/.git/objects/17/7b0dc4bf884f8ae0403b4aad053e76baafd632 +2 -0
  35. package/.git/objects/1d/a517ce3527df45a4f28e52ff2c0d9d1c8179f6 +0 -0
  36. package/.git/objects/27/50076ed23b5211a52ef834f40f183ddecb917a +0 -0
  37. package/.git/objects/2a/96e4bb57fa4bd69c719dca224b17b569e94e82 +2 -0
  38. package/.git/objects/2b/38c26b4ec43b8f5574acb164d2ba64bca8e230 +0 -0
  39. package/.git/objects/2c/61d463bee185f04e7c2bd1d2a15ad1117c589e +0 -0
  40. package/.git/objects/2d/22dbc836cfd75c8d7640ebe5a4fe90bd2c23c6 +0 -0
  41. package/.git/objects/2e/58414df7b4d5c972167a83270f78fc4ed508f5 +0 -0
  42. package/.git/objects/38/0be191ee415827a1217f46626fea4fefba48e5 +0 -0
  43. package/.git/objects/3a/93aa29cd19bdc95a87d15910baec8455f8b7b7 +0 -0
  44. package/.git/objects/50/150b739272269be2ede552448013eba65323da +0 -0
  45. package/.git/objects/53/2b7b796ffd3223f913a5a5e1e17743ee3591fe +0 -0
  46. package/.git/objects/54/a8535f50287f6a7a8c00aed143ca6e5ee5f5d1 +0 -0
  47. package/.git/objects/5d/4aa0709f62f1bc1fa80251208b570cb3b89d9c +0 -0
  48. package/.git/objects/63/1c43e00d4c34ba914c510f4fe2e6df15b8b06e +0 -0
  49. package/.git/objects/63/9900d13c6182e452e33a3bd638e70a0146c785 +2 -0
  50. package/.git/objects/64/3fa02661c3a1b54205729a75d2fb5f013833af +0 -0
  51. package/.git/objects/6c/59086d862516d2fffa5da2035e5003100fb5c7 +0 -0
  52. package/.git/objects/6c/b74f90a0c799eea1c54a04d8d6a8a9e9691cca +2 -0
  53. package/.git/objects/70/0e093acb1c1e55d523507411b7940a01a3bb65 +0 -0
  54. package/.git/objects/71/1ba2014bc137dece4c4156ff5e77e6abaeb95c +0 -0
  55. package/.git/objects/74/c82ffe8eb71efecbccfdf67b590949c944dd1a +0 -0
  56. package/.git/objects/76/1413a07839108abb46ef0e4490bd1c1444b4fc +0 -0
  57. package/.git/objects/77/96f8282f2c553ecdde72bc976478eb3a8a948e +0 -0
  58. package/.git/objects/79/ee123c2b23e069e35ed634d687e17f731cc702 +0 -0
  59. package/.git/objects/7d/80af9735f0527db35ecc79ae3c887e445cb3e0 +0 -0
  60. package/.git/objects/85/1d8d26c2a946ccfd5461a2573665c1fb7d71f7 +0 -0
  61. package/.git/objects/85/c5f24b8c55496f82a2680f94a7d3fa32887ea0 +0 -0
  62. package/.git/objects/87/00b3833597b600e6f0ffcfbaf622fd8cfaa9c3 +1 -0
  63. package/.git/objects/87/f31d3df8e7edbf96e45d80126f878b8e0c243f +0 -0
  64. package/.git/objects/8b/cc95b71b20c79513e9157b921238ca2c79f906 +0 -0
  65. package/.git/objects/8d/d819967bdc8457f04c1b5498bce89380d6552b +7 -0
  66. package/.git/objects/91/b0fba96bf994b6232bb923f2a9929fc258a05f +0 -0
  67. package/.git/objects/92/608c4e069a4301d466d8d18daecbe7abc9500e +0 -0
  68. package/.git/objects/94/a25f7f4cb416c083d265558da75d457237d671 +0 -0
  69. package/.git/objects/9c/69411050eac81b5dce09314516a30b38c41a20 +3 -0
  70. package/.git/objects/9f/54b5b21769da383f12fb9c7bd364bdb05e13a9 +0 -0
  71. package/.git/objects/a5/886c22eb68b152bb95ec5151504676d8e78ae1 +0 -0
  72. package/.git/objects/a6/582c9510e264f3b46fc3b20597a16923a03523 +0 -0
  73. package/.git/objects/a9/d7db9c0a81b2db47ca92e4e180b30090b27632 +0 -0
  74. package/.git/objects/ad/c418f9105db9ec488de6831584b82e3929eaef +0 -0
  75. package/.git/objects/b0/c1c68fbbad6b190434cd2bb0e807796bd56fca +0 -0
  76. package/.git/objects/b1/0f0d0ef3bc5aaf3a91be0b991cb6fe0fcadc40 +0 -0
  77. package/.git/objects/b6/3b642cfb4254fc0f7058903abc5b481895c4ef +0 -0
  78. package/.git/objects/b8/a2c461d7ffed9d4ba242c58a52341832b99e0a +0 -0
  79. package/.git/objects/ba/5b53857ced8d97f6d6e3fb3538b3273743dafc +2 -0
  80. package/.git/objects/ba/5ef7104c0d019a9692cd2d78261d96f29e916f +0 -0
  81. package/.git/objects/bc/91e0079eb00d56dcde16714748f36a10dbd525 +0 -0
  82. package/.git/objects/c1/beeb895b71b709e48560460199db11b3fc18af +0 -0
  83. package/.git/objects/c5/166c2aeebaeb0a0f7654223c843c50cd4c8953 +0 -0
  84. package/.git/objects/d4/0a2096fc36c1fd9c7a9263c458d5e8a4a5bee7 +0 -0
  85. package/.git/objects/e1/b744bc6076ebeb02fa86af98583ac22e070ec0 +0 -0
  86. package/.git/objects/e8/019be9e978a8e2f094e748cbb6ce0c7163adee +0 -0
  87. package/.git/objects/eb/1d744c4e9b47bc902647298424320078e32980 +0 -0
  88. package/.git/objects/ee/15af38be7f3c3862229e59c6b5688f8e0f6099 +0 -0
  89. package/.git/objects/f1/9e0f429f231c34432784f9e33b92ac1d598c17 +0 -0
  90. package/.git/objects/f9/86f2fe82493e85651396b6d5886316d1c890dd +0 -0
  91. package/.git/refs/heads/main +1 -0
  92. package/.git/refs/remotes/origin/main +1 -0
  93. package/.git/refs/tags/v0.1.1 +1 -0
  94. package/.git/shallow +1 -0
  95. package/.github/dependabot.yml +10 -0
  96. package/.github/workflows/ci.yml +12 -0
  97. package/.github/workflows/issues.yml +13 -0
  98. package/.github/workflows/publish.yml +21 -0
  99. package/.gitignore +13 -0
  100. package/.idea/.gitignore +10 -0
  101. package/.idea/aws.xml +11 -0
  102. package/.idea/codeStyles/Project.xml +58 -0
  103. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  104. package/.idea/commons-js.iml +14 -0
  105. package/.idea/inspectionProfiles/Project_Default.xml +7 -0
  106. package/.idea/misc.xml +6 -0
  107. package/.idea/modules.xml +8 -0
  108. package/.idea/prettier.xml +6 -0
  109. package/.idea/vcs.xml +6 -0
  110. package/.npmrc +1 -0
  111. package/.prettierignore +7 -0
  112. package/.prettierrc.cjs +3 -0
  113. package/LICENSE +26 -0
  114. package/README.md +14 -0
  115. package/coverage/base.css +224 -0
  116. package/coverage/bitsnbytes/b64.mts.html +559 -0
  117. package/coverage/bitsnbytes/index.html +131 -0
  118. package/coverage/bitsnbytes/index.mts.html +88 -0
  119. package/coverage/clover.xml +1003 -0
  120. package/coverage/coverage-final.json +15 -0
  121. package/coverage/errors/errors.mts.html +898 -0
  122. package/coverage/errors/index.html +131 -0
  123. package/coverage/errors/index.mts.html +88 -0
  124. package/coverage/favicon.png +0 -0
  125. package/coverage/http/http-method.mts.html +112 -0
  126. package/coverage/http/http-status-code.mts.html +211 -0
  127. package/coverage/http/index.html +146 -0
  128. package/coverage/http/index.mts.html +91 -0
  129. package/coverage/index.html +191 -0
  130. package/coverage/lang/index.html +146 -0
  131. package/coverage/lang/index.mts.html +91 -0
  132. package/coverage/lang/sleep.mts.html +109 -0
  133. package/coverage/lang/type-functions.mts.html +124 -0
  134. package/coverage/oauth/crypto-functions.mts.html +217 -0
  135. package/coverage/oauth/index.html +131 -0
  136. package/coverage/oauth/index.mts.html +88 -0
  137. package/coverage/prettify.css +1 -0
  138. package/coverage/sort-arrow-sprite.png +0 -0
  139. package/coverage/validator/index.html +131 -0
  140. package/coverage/validator/index.mts.html +88 -0
  141. package/coverage/validator/validators.mts.html +1237 -0
  142. package/dist/package.json +72 -0
  143. package/node_modules/@eslint/eslintrc/LICENSE +19 -0
  144. package/node_modules/@eslint/eslintrc/README.md +115 -0
  145. package/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs +1104 -0
  146. package/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs.map +1 -0
  147. package/node_modules/@eslint/eslintrc/dist/eslintrc.cjs +4344 -0
  148. package/node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map +1 -0
  149. package/node_modules/@eslint/eslintrc/package.json +82 -0
  150. package/node_modules/@eslint/eslintrc/universal.js +9 -0
  151. package/node_modules/@eslint/js/LICENSE +19 -0
  152. package/node_modules/@eslint/js/README.md +57 -0
  153. package/node_modules/@eslint/js/package.json +31 -0
  154. package/node_modules/@eslint/js/src/index.js +17 -0
  155. package/node_modules/@eslint-community/eslint-utils/LICENSE +21 -0
  156. package/node_modules/@eslint-community/eslint-utils/README.md +37 -0
  157. package/node_modules/@eslint-community/eslint-utils/index.js +2068 -0
  158. package/node_modules/@eslint-community/eslint-utils/index.js.map +1 -0
  159. package/node_modules/@eslint-community/eslint-utils/index.mjs +2027 -0
  160. package/node_modules/@eslint-community/eslint-utils/index.mjs.map +1 -0
  161. package/node_modules/@eslint-community/eslint-utils/package.json +73 -0
  162. package/node_modules/@eslint-community/regexpp/LICENSE +21 -0
  163. package/node_modules/@eslint-community/regexpp/README.md +177 -0
  164. package/node_modules/@eslint-community/regexpp/index.d.ts +1065 -0
  165. package/node_modules/@eslint-community/regexpp/index.js +2747 -0
  166. package/node_modules/@eslint-community/regexpp/index.js.map +1 -0
  167. package/node_modules/@eslint-community/regexpp/index.mjs +2737 -0
  168. package/node_modules/@eslint-community/regexpp/index.mjs.map +1 -0
  169. package/node_modules/@eslint-community/regexpp/package.json +93 -0
  170. package/node_modules/@types/node/LICENSE +21 -0
  171. package/node_modules/@types/node/README.md +15 -0
  172. package/node_modules/@types/node/package.json +217 -0
  173. package/node_modules/@typescript-eslint/eslint-plugin/LICENSE +21 -0
  174. package/node_modules/@typescript-eslint/eslint-plugin/README.md +10 -0
  175. package/node_modules/@typescript-eslint/eslint-plugin/dist/index.js +23 -0
  176. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/README.md +23 -0
  177. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/TEMPLATE.md +26 -0
  178. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/adjacent-overload-signatures.md +93 -0
  179. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/array-type.md +103 -0
  180. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/await-thenable.md +40 -0
  181. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-ts-comment.md +148 -0
  182. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-tslint-comment.md +39 -0
  183. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-types.md +183 -0
  184. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/block-spacing.md +12 -0
  185. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/brace-style.md +12 -0
  186. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/camelcase.md +10 -0
  187. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/class-literal-property-style.md +114 -0
  188. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/comma-dangle.md +22 -0
  189. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/comma-spacing.md +12 -0
  190. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-generic-constructors.md +73 -0
  191. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-indexed-object-style.md +80 -0
  192. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-assertions.md +108 -0
  193. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-definitions.md +82 -0
  194. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-exports.md +100 -0
  195. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-imports.md +105 -0
  196. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/default-param-last.md +48 -0
  197. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/dot-notation.md +77 -0
  198. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/explicit-function-return-type.md +319 -0
  199. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/explicit-member-accessibility.md +331 -0
  200. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/explicit-module-boundary-types.md +250 -0
  201. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/func-call-spacing.md +12 -0
  202. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/indent.md +20 -0
  203. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/init-declarations.md +12 -0
  204. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/key-spacing.md +12 -0
  205. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/keyword-spacing.md +12 -0
  206. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/lines-around-comment.md +37 -0
  207. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/lines-between-class-members.md +63 -0
  208. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/member-delimiter-style.md +161 -0
  209. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/member-ordering.md +1360 -0
  210. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/method-signature-style.md +110 -0
  211. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/naming-convention.md +706 -0
  212. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-array-constructor.md +35 -0
  213. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-base-to-string.md +88 -0
  214. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-confusing-non-null-assertion.md +56 -0
  215. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-confusing-void-expression.md +116 -0
  216. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-dupe-class-members.md +12 -0
  217. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-duplicate-enum-values.md +50 -0
  218. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-duplicate-imports.md +12 -0
  219. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-duplicate-type-constituents.md +61 -0
  220. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-dynamic-delete.md +53 -0
  221. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-empty-function.md +88 -0
  222. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-empty-interface.md +70 -0
  223. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-explicit-any.md +174 -0
  224. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extra-non-null-assertion.md +52 -0
  225. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extra-parens.md +12 -0
  226. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extra-semi.md +12 -0
  227. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extraneous-class.md +294 -0
  228. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-floating-promises.md +106 -0
  229. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-for-in-array.md +56 -0
  230. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-implicit-any-catch.md +73 -0
  231. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-implied-eval.md +101 -0
  232. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-import-type-side-effects.md +75 -0
  233. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-inferrable-types.md +103 -0
  234. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-invalid-this.md +12 -0
  235. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-invalid-void-type.md +113 -0
  236. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-loop-func.md +12 -0
  237. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-loss-of-precision.md +12 -0
  238. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-magic-numbers.md +131 -0
  239. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-meaningless-void-operator.md +47 -0
  240. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-misused-new.md +46 -0
  241. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-misused-promises.md +245 -0
  242. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-mixed-enums.md +88 -0
  243. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-namespace.md +129 -0
  244. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-non-null-asserted-nullish-coalescing.md +49 -0
  245. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-non-null-asserted-optional-chain.md +35 -0
  246. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-non-null-assertion.md +42 -0
  247. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-parameter-properties.md +406 -0
  248. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-redeclare.md +73 -0
  249. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-redundant-type-constituents.md +78 -0
  250. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-require-imports.md +37 -0
  251. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-restricted-imports.md +63 -0
  252. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-shadow.md +101 -0
  253. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-this-alias.md +38 -0
  254. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-throw-literal.md +111 -0
  255. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-type-alias.md +602 -0
  256. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-boolean-literal-compare.md +133 -0
  257. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-condition.md +103 -0
  258. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-qualifier.md +51 -0
  259. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-type-arguments.md +73 -0
  260. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md +77 -0
  261. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md +55 -0
  262. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-argument.md +83 -0
  263. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-assignment.md +86 -0
  264. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-call.md +58 -0
  265. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-declaration-merging.md +54 -0
  266. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-enum-comparison.md +75 -0
  267. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-member-access.md +64 -0
  268. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-return.md +103 -0
  269. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unused-expressions.md +12 -0
  270. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unused-vars.md +12 -0
  271. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-use-before-define.md +97 -0
  272. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-useless-constructor.md +21 -0
  273. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-useless-empty-export.md +43 -0
  274. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-var-requires.md +37 -0
  275. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/non-nullable-type-assertion-style.md +41 -0
  276. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/object-curly-spacing.md +12 -0
  277. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/padding-line-between-statements.md +35 -0
  278. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/parameter-properties.md +485 -0
  279. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-as-const.md +44 -0
  280. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-enum-initializers.md +62 -0
  281. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-for-of.md +46 -0
  282. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-function-type.md +92 -0
  283. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-includes.md +77 -0
  284. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-literal-enum-member.md +101 -0
  285. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-namespace-keyword.md +47 -0
  286. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-nullish-coalescing.md +164 -0
  287. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-optional-chain.md +71 -0
  288. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-readonly-parameter-types.md +268 -0
  289. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-readonly.md +87 -0
  290. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-reduce-type-parameter.md +58 -0
  291. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-regexp-exec.md +46 -0
  292. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-return-this-type.md +87 -0
  293. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-string-starts-ends-with.md +57 -0
  294. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-ts-expect-error.md +69 -0
  295. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/promise-function-async.md +59 -0
  296. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/quotes.md +12 -0
  297. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/require-array-sort-compare.md +78 -0
  298. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/require-await.md +24 -0
  299. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/restrict-plus-operands.md +208 -0
  300. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/restrict-template-expressions.md +117 -0
  301. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/return-await.md +216 -0
  302. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/semi.md +16 -0
  303. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/sort-type-constituents.md +101 -0
  304. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/sort-type-union-intersection-members.md +106 -0
  305. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/space-before-blocks.md +42 -0
  306. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/space-before-function-paren.md +12 -0
  307. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/space-infix-ops.md +16 -0
  308. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/strict-boolean-expressions.md +183 -0
  309. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/switch-exhaustiveness-check.md +106 -0
  310. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/triple-slash-reference.md +61 -0
  311. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/type-annotation-spacing.md +303 -0
  312. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/typedef.md +320 -0
  313. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/unbound-method.md +103 -0
  314. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/unified-signatures.md +70 -0
  315. package/node_modules/@typescript-eslint/eslint-plugin/index.d.ts +4 -0
  316. package/node_modules/@typescript-eslint/eslint-plugin/package.json +87 -0
  317. package/node_modules/@typescript-eslint/parser/LICENSE +22 -0
  318. package/node_modules/@typescript-eslint/parser/README.md +10 -0
  319. package/node_modules/@typescript-eslint/parser/dist/index.js +17 -0
  320. package/node_modules/@typescript-eslint/parser/package.json +75 -0
  321. package/node_modules/@typescript-eslint/scope-manager/LICENSE +21 -0
  322. package/node_modules/@typescript-eslint/scope-manager/README.md +8 -0
  323. package/node_modules/@typescript-eslint/scope-manager/dist/index.js +31 -0
  324. package/node_modules/@typescript-eslint/scope-manager/package.json +67 -0
  325. package/node_modules/@typescript-eslint/type-utils/LICENSE +21 -0
  326. package/node_modules/@typescript-eslint/type-utils/README.md +12 -0
  327. package/node_modules/@typescript-eslint/type-utils/dist/index.js +36 -0
  328. package/node_modules/@typescript-eslint/type-utils/package.json +71 -0
  329. package/node_modules/@typescript-eslint/types/LICENSE +21 -0
  330. package/node_modules/@typescript-eslint/types/README.md +12 -0
  331. package/node_modules/@typescript-eslint/types/dist/index.js +24 -0
  332. package/node_modules/@typescript-eslint/types/package.json +84 -0
  333. package/node_modules/@typescript-eslint/typescript-estree/LICENSE +26 -0
  334. package/node_modules/@typescript-eslint/typescript-estree/README.md +10 -0
  335. package/node_modules/@typescript-eslint/typescript-estree/dist/index.js +38 -0
  336. package/node_modules/@typescript-eslint/typescript-estree/package.json +85 -0
  337. package/node_modules/@typescript-eslint/utils/LICENSE +21 -0
  338. package/node_modules/@typescript-eslint/utils/README.md +10 -0
  339. package/node_modules/@typescript-eslint/utils/dist/index.js +41 -0
  340. package/node_modules/@typescript-eslint/utils/package.json +70 -0
  341. package/node_modules/@typescript-eslint/visitor-keys/LICENSE +21 -0
  342. package/node_modules/@typescript-eslint/visitor-keys/README.md +10 -0
  343. package/node_modules/@typescript-eslint/visitor-keys/dist/index.js +8 -0
  344. package/node_modules/@typescript-eslint/visitor-keys/package.json +60 -0
  345. package/node_modules/@vitest/coverage-v8/LICENSE +21 -0
  346. package/node_modules/@vitest/coverage-v8/dist/index.js +54 -0
  347. package/node_modules/@vitest/coverage-v8/package.json +72 -0
  348. package/package.json +6 -6
  349. package/pnpm-lock.yaml +3277 -0
  350. package/src/bitsnbytes/b64.mts +158 -0
  351. package/src/bitsnbytes/b64.test.mts +78 -0
  352. package/src/bitsnbytes/index.mts +1 -0
  353. package/src/errors/errors.mts +271 -0
  354. package/src/errors/errors.test.mts +74 -0
  355. package/src/errors/index.mts +1 -0
  356. package/src/http/http-method.mts +9 -0
  357. package/src/http/http-status-code.mts +42 -0
  358. package/src/http/index.mts +2 -0
  359. package/src/lang/index.mts +2 -0
  360. package/src/lang/sleep.mts +8 -0
  361. package/src/lang/type-functions.mts +13 -0
  362. package/src/oauth/crypto-functions.mts +44 -0
  363. package/src/oauth/crypto-functions.test.mts +48 -0
  364. package/src/oauth/index.mts +1 -0
  365. package/src/validator/index.mts +1 -0
  366. package/src/validator/validators.mts +384 -0
  367. package/src/validator/validators.test.mts +245 -0
  368. package/tsconfig.json +18 -0
  369. /package/{bitsnbytes → dist/bitsnbytes}/b64.d.mts +0 -0
  370. /package/{bitsnbytes → dist/bitsnbytes}/b64.d.mts.map +0 -0
  371. /package/{bitsnbytes → dist/bitsnbytes}/b64.mjs +0 -0
  372. /package/{bitsnbytes → dist/bitsnbytes}/b64.mjs.map +0 -0
  373. /package/{bitsnbytes → dist/bitsnbytes}/b64.test.d.mts +0 -0
  374. /package/{bitsnbytes → dist/bitsnbytes}/b64.test.d.mts.map +0 -0
  375. /package/{bitsnbytes → dist/bitsnbytes}/b64.test.mjs +0 -0
  376. /package/{bitsnbytes → dist/bitsnbytes}/b64.test.mjs.map +0 -0
  377. /package/{bitsnbytes → dist/bitsnbytes}/index.d.mts +0 -0
  378. /package/{bitsnbytes → dist/bitsnbytes}/index.d.mts.map +0 -0
  379. /package/{bitsnbytes → dist/bitsnbytes}/index.mjs +0 -0
  380. /package/{bitsnbytes → dist/bitsnbytes}/index.mjs.map +0 -0
  381. /package/{errors → dist/errors}/errors.d.mts +0 -0
  382. /package/{errors → dist/errors}/errors.d.mts.map +0 -0
  383. /package/{errors → dist/errors}/errors.mjs +0 -0
  384. /package/{errors → dist/errors}/errors.mjs.map +0 -0
  385. /package/{errors → dist/errors}/errors.test.d.mts +0 -0
  386. /package/{errors → dist/errors}/errors.test.d.mts.map +0 -0
  387. /package/{errors → dist/errors}/errors.test.mjs +0 -0
  388. /package/{errors → dist/errors}/errors.test.mjs.map +0 -0
  389. /package/{errors → dist/errors}/index.d.mts +0 -0
  390. /package/{errors → dist/errors}/index.d.mts.map +0 -0
  391. /package/{errors → dist/errors}/index.mjs +0 -0
  392. /package/{errors → dist/errors}/index.mjs.map +0 -0
  393. /package/{http → dist/http}/http-method.d.mts +0 -0
  394. /package/{http → dist/http}/http-method.d.mts.map +0 -0
  395. /package/{http → dist/http}/http-method.mjs +0 -0
  396. /package/{http → dist/http}/http-method.mjs.map +0 -0
  397. /package/{http → dist/http}/http-status-code.d.mts +0 -0
  398. /package/{http → dist/http}/http-status-code.d.mts.map +0 -0
  399. /package/{http → dist/http}/http-status-code.mjs +0 -0
  400. /package/{http → dist/http}/http-status-code.mjs.map +0 -0
  401. /package/{http → dist/http}/index.d.mts +0 -0
  402. /package/{http → dist/http}/index.d.mts.map +0 -0
  403. /package/{http → dist/http}/index.mjs +0 -0
  404. /package/{http → dist/http}/index.mjs.map +0 -0
  405. /package/{lang → dist/lang}/index.d.mts +0 -0
  406. /package/{lang → dist/lang}/index.d.mts.map +0 -0
  407. /package/{lang → dist/lang}/index.mjs +0 -0
  408. /package/{lang → dist/lang}/index.mjs.map +0 -0
  409. /package/{lang → dist/lang}/sleep.d.mts +0 -0
  410. /package/{lang → dist/lang}/sleep.d.mts.map +0 -0
  411. /package/{lang → dist/lang}/sleep.mjs +0 -0
  412. /package/{lang → dist/lang}/sleep.mjs.map +0 -0
  413. /package/{lang → dist/lang}/type-functions.d.mts +0 -0
  414. /package/{lang → dist/lang}/type-functions.d.mts.map +0 -0
  415. /package/{lang → dist/lang}/type-functions.mjs +0 -0
  416. /package/{lang → dist/lang}/type-functions.mjs.map +0 -0
  417. /package/{oauth → dist/oauth}/crypto-functions.d.mts +0 -0
  418. /package/{oauth → dist/oauth}/crypto-functions.d.mts.map +0 -0
  419. /package/{oauth → dist/oauth}/crypto-functions.mjs +0 -0
  420. /package/{oauth → dist/oauth}/crypto-functions.mjs.map +0 -0
  421. /package/{oauth → dist/oauth}/crypto-functions.test.d.mts +0 -0
  422. /package/{oauth → dist/oauth}/crypto-functions.test.d.mts.map +0 -0
  423. /package/{oauth → dist/oauth}/crypto-functions.test.mjs +0 -0
  424. /package/{oauth → dist/oauth}/crypto-functions.test.mjs.map +0 -0
  425. /package/{oauth → dist/oauth}/index.d.mts +0 -0
  426. /package/{oauth → dist/oauth}/index.d.mts.map +0 -0
  427. /package/{oauth → dist/oauth}/index.mjs +0 -0
  428. /package/{oauth → dist/oauth}/index.mjs.map +0 -0
  429. /package/{validator → dist/validator}/index.d.mts +0 -0
  430. /package/{validator → dist/validator}/index.d.mts.map +0 -0
  431. /package/{validator → dist/validator}/index.mjs +0 -0
  432. /package/{validator → dist/validator}/index.mjs.map +0 -0
  433. /package/{validator → dist/validator}/validators.d.mts +0 -0
  434. /package/{validator → dist/validator}/validators.d.mts.map +0 -0
  435. /package/{validator → dist/validator}/validators.mjs +0 -0
  436. /package/{validator → dist/validator}/validators.mjs.map +0 -0
  437. /package/{validator → dist/validator}/validators.test.d.mts +0 -0
  438. /package/{validator → dist/validator}/validators.test.d.mts.map +0 -0
  439. /package/{validator → dist/validator}/validators.test.mjs +0 -0
  440. /package/{validator → dist/validator}/validators.test.mjs.map +0 -0
@@ -0,0 +1,73 @@
1
+ ---
2
+ description: 'Disallow usage of the implicit `any` type in catch clauses.'
3
+ ---
4
+
5
+ > 🛑 This file is source code, not the primary documentation location! 🛑
6
+ >
7
+ > See **https://typescript-eslint.io/rules/no-implicit-any-catch** for documentation.
8
+
9
+ :::danger Deprecated
10
+
11
+ This rule has been deprecated as TypeScript versions >=4 includes a `useUnknownInCatchVariables` compiler option with the same check.
12
+ :::
13
+
14
+ TypeScript 4.0 added support for adding an explicit `any` or `unknown` type annotation on a catch clause variable.
15
+
16
+ By default, TypeScript will type a catch clause variable as `any`, so explicitly annotating it as `unknown` can add a lot of safety to your codebase.
17
+
18
+ The `noImplicitAny` flag in TypeScript does not cover this for backwards compatibility reasons, however you can use `useUnknownInCatchVariables` (part of `strict`) instead of this rule.
19
+
20
+ ## DEPRECATED
21
+
22
+ ## Examples
23
+
24
+ This rule requires an explicit type to be declared on a catch clause variable.
25
+
26
+ <!--tabs-->
27
+
28
+ ### ❌ Incorrect
29
+
30
+ ```ts
31
+ try {
32
+ // ...
33
+ } catch (e) {
34
+ // ...
35
+ }
36
+ ```
37
+
38
+ ### ✅ Correct
39
+
40
+ <!-- TODO: prettier currently removes the type annotations, re-enable this once prettier is updated -->
41
+ <!-- prettier-ignore-start -->
42
+
43
+ ```ts
44
+ try {
45
+ // ...
46
+ } catch (e: unknown) {
47
+ // ...
48
+ }
49
+ ```
50
+
51
+ <!-- prettier-ignore-end -->
52
+
53
+ ## Options
54
+
55
+ ### `allowExplicitAny`
56
+
57
+ The follow is is **_not_** considered a warning with `{ allowExplicitAny: true }`
58
+
59
+ ```ts
60
+ try {
61
+ // ...
62
+ } catch (e: any) {
63
+ // ...
64
+ }
65
+ ```
66
+
67
+ ## When Not To Use It
68
+
69
+ If you are not using TypeScript 4.0 (or greater), then you will not be able to use this rule, annotations on catch clauses is not supported.
70
+
71
+ ## Further Reading
72
+
73
+ - [TypeScript 4.0 Release Notes](https://devblogs.microsoft.com/typescript/announcing-typescript-4-0/#unknown-on-catch)
@@ -0,0 +1,101 @@
1
+ ---
2
+ description: 'Disallow the use of `eval()`-like methods.'
3
+ ---
4
+
5
+ > 🛑 This file is source code, not the primary documentation location! 🛑
6
+ >
7
+ > See **https://typescript-eslint.io/rules/no-implied-eval** for documentation.
8
+
9
+ It's considered a good practice to avoid using `eval()`. There are security and performance implications involved with doing so, which is why many linters recommend disallowing `eval()`. However, there are some other ways to pass a string and have it interpreted as JavaScript code that have similar concerns.
10
+
11
+ The first is using `setTimeout()`, `setInterval()`, `setImmediate` or `execScript()` (Internet Explorer only), all of which can accept a string of code as their first argument
12
+
13
+ ```ts
14
+ setTimeout('alert(`Hi!`);', 100);
15
+ ```
16
+
17
+ or using `new Function()`
18
+
19
+ ```ts
20
+ const fn = new Function('a', 'b', 'return a + b');
21
+ ```
22
+
23
+ This is considered an implied `eval()` because a string of code is
24
+ passed in to be interpreted. The same can be done with `setInterval()`, `setImmediate()` and `execScript()`. All interpret the JavaScript code in the global scope.
25
+
26
+ The best practice is to avoid using `new Function()` or `execScript()` and always use a function for the first argument of `setTimeout()`, `setInterval()` and `setImmediate()`.
27
+
28
+ ## Examples
29
+
30
+ This rule aims to eliminate implied `eval()` through the use of `new Function()`, `setTimeout()`, `setInterval()`, `setImmediate()` or `execScript()`.
31
+
32
+ <!--tabs-->
33
+
34
+ ### ❌ Incorrect
35
+
36
+ ```ts
37
+ /* eslint @typescript-eslint/no-implied-eval: "error" */
38
+
39
+ setTimeout('alert(`Hi!`);', 100);
40
+
41
+ setInterval('alert(`Hi!`);', 100);
42
+
43
+ setImmediate('alert(`Hi!`)');
44
+
45
+ execScript('alert(`Hi!`)');
46
+
47
+ window.setTimeout('count = 5', 10);
48
+
49
+ window.setInterval('foo = bar', 10);
50
+
51
+ const fn = '() = {}';
52
+ setTimeout(fn, 100);
53
+
54
+ const fn = () => {
55
+ return 'x = 10';
56
+ };
57
+ setTimeout(fn(), 100);
58
+
59
+ const fn = new Function('a', 'b', 'return a + b');
60
+ ```
61
+
62
+ ### ✅ Correct
63
+
64
+ ```ts
65
+ /* eslint @typescript-eslint/no-implied-eval: "error" */
66
+
67
+ setTimeout(function () {
68
+ alert('Hi!');
69
+ }, 100);
70
+
71
+ setInterval(function () {
72
+ alert('Hi!');
73
+ }, 100);
74
+
75
+ setImmediate(function () {
76
+ alert('Hi!');
77
+ });
78
+
79
+ execScript(function () {
80
+ alert('Hi!');
81
+ });
82
+
83
+ const fn = () => {};
84
+ setTimeout(fn, 100);
85
+
86
+ const foo = {
87
+ fn: function () {},
88
+ };
89
+ setTimeout(foo.fn, 100);
90
+ setTimeout(foo.fn.bind(this), 100);
91
+
92
+ class Foo {
93
+ static fn = () => {};
94
+ }
95
+
96
+ setTimeout(Foo.fn, 100);
97
+ ```
98
+
99
+ ## When Not To Use It
100
+
101
+ If you want to allow `new Function()` or `setTimeout()`, `setInterval()`, `setImmediate()` and `execScript()` with string arguments, then you can safely disable this rule.
@@ -0,0 +1,75 @@
1
+ ---
2
+ description: 'Enforce the use of top-level import type qualifier when an import only has specifiers with inline type qualifiers.'
3
+ ---
4
+
5
+ > 🛑 This file is source code, not the primary documentation location! 🛑
6
+ >
7
+ > See **https://typescript-eslint.io/rules/no-import-type-side-effects** for documentation.
8
+
9
+ The [`--verbatimModuleSyntax`](https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax) compiler option causes TypeScript to do simple and predictable transpilation on import declarations.
10
+ Namely, it completely removes import declarations with a top-level `type` qualifier, and it removes any import specifiers with an inline `type` qualifier.
11
+
12
+ The latter behavior does have one potentially surprising effect in that in certain cases TS can leave behind a "side effect" import at runtime:
13
+
14
+ ```ts
15
+ import { type A, type B } from 'mod';
16
+
17
+ // is transpiled to
18
+
19
+ import {} from 'mod';
20
+ // which is the same as
21
+ import 'mod';
22
+ ```
23
+
24
+ For the rare case of needing to import for side effects, this may be desirable - but for most cases you will not want to leave behind an unnecessary side effect import.
25
+
26
+ ## Examples
27
+
28
+ This rule enforces that you use a top-level `type` qualifier for imports when it only imports specifiers with an inline `type` qualifier
29
+
30
+ <!--tabs-->
31
+
32
+ ### ❌ Incorrect
33
+
34
+ ```ts
35
+ import { type A } from 'mod';
36
+ import { type A as AA } from 'mod';
37
+ import { type A, type B } from 'mod';
38
+ import { type A as AA, type B as BB } from 'mod';
39
+ ```
40
+
41
+ ### ✅ Correct
42
+
43
+ ```ts
44
+ import type { A } from 'mod';
45
+ import type { A as AA } from 'mod';
46
+ import type { A, B } from 'mod';
47
+ import type { A as AA, B as BB } from 'mod';
48
+
49
+ import T from 'mod';
50
+ import type T from 'mod';
51
+
52
+ import * as T from 'mod';
53
+ import type * as T from 'mod';
54
+
55
+ import { T } from 'mod';
56
+ import type { T } from 'mod';
57
+ import { T, U } from 'mod';
58
+ import type { T, U } from 'mod';
59
+ import { type T, U } from 'mod';
60
+ import { T, type U } from 'mod';
61
+
62
+ import type T, { U } from 'mod';
63
+ import T, { type U } from 'mod';
64
+ ```
65
+
66
+ ## When Not To Use It
67
+
68
+ - If you want to leave behind side effect imports, then you shouldn't use this rule.
69
+ - If you're not using TypeScript 5.0's `verbatimModuleSyntax` option, then you don't need this rule.
70
+
71
+ ## Related To
72
+
73
+ - [`consistent-type-imports`](./consistent-type-imports.md)
74
+ - [`import/consistent-type-specifier-style`](https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/consistent-type-specifier-style.md)
75
+ - [`import/no-duplicates` with `{"prefer-inline": true}`](https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-duplicates.md#inline-type-imports)
@@ -0,0 +1,103 @@
1
+ ---
2
+ description: 'Disallow explicit type declarations for variables or parameters initialized to a number, string, or boolean.'
3
+ ---
4
+
5
+ > 🛑 This file is source code, not the primary documentation location! 🛑
6
+ >
7
+ > See **https://typescript-eslint.io/rules/no-inferrable-types** for documentation.
8
+
9
+ TypeScript is able to infer the types of parameters, properties, and variables from their default or initial values.
10
+ There is no need to use an explicit `:` type annotation on one of those constructs initialized to a boolean, number, or string.
11
+ Doing so adds unnecessary verbosity to code -making it harder to read- and in some cases can prevent TypeScript from inferring a more specific literal type (e.g. `10`) instead of the more general primitive type (e.g. `number`)
12
+
13
+ ## Examples
14
+
15
+ <!--tabs-->
16
+
17
+ ### ❌ Incorrect
18
+
19
+ ```ts
20
+ const a: bigint = 10n;
21
+ const a: bigint = BigInt(10);
22
+ const a: boolean = !0;
23
+ const a: boolean = Boolean(null);
24
+ const a: boolean = true;
25
+ const a: null = null;
26
+ const a: number = 10;
27
+ const a: number = Infinity;
28
+ const a: number = NaN;
29
+ const a: number = Number('1');
30
+ const a: RegExp = /a/;
31
+ const a: RegExp = new RegExp('a');
32
+ const a: string = `str`;
33
+ const a: string = String(1);
34
+ const a: symbol = Symbol('a');
35
+ const a: undefined = undefined;
36
+ const a: undefined = void someValue;
37
+
38
+ class Foo {
39
+ prop: number = 5;
40
+ }
41
+
42
+ function fn(a: number = 5, b: boolean = true) {}
43
+ ```
44
+
45
+ ### ✅ Correct
46
+
47
+ ```ts
48
+ const a = 10n;
49
+ const a = BigInt(10);
50
+ const a = !0;
51
+ const a = Boolean(null);
52
+ const a = true;
53
+ const a = null;
54
+ const a = 10;
55
+ const a = Infinity;
56
+ const a = NaN;
57
+ const a = Number('1');
58
+ const a = /a/;
59
+ const a = new RegExp('a');
60
+ const a = `str`;
61
+ const a = String(1);
62
+ const a = Symbol('a');
63
+ const a = undefined;
64
+ const a = void someValue;
65
+
66
+ class Foo {
67
+ prop = 5;
68
+ }
69
+
70
+ function fn(a = 5, b = true) {}
71
+ ```
72
+
73
+ <!--/tabs-->
74
+
75
+ ## Options
76
+
77
+ ### `ignoreParameters`
78
+
79
+ When set to true, the following pattern is considered valid:
80
+
81
+ ```ts
82
+ function foo(a: number = 5, b: boolean = true) {
83
+ // ...
84
+ }
85
+ ```
86
+
87
+ ### `ignoreProperties`
88
+
89
+ When set to true, the following pattern is considered valid:
90
+
91
+ ```ts
92
+ class Foo {
93
+ prop: number = 5;
94
+ }
95
+ ```
96
+
97
+ ## When Not To Use It
98
+
99
+ If you do not want to enforce inferred types.
100
+
101
+ ## Further Reading
102
+
103
+ TypeScript [Inference](https://www.typescriptlang.org/docs/handbook/type-inference.html)
@@ -0,0 +1,12 @@
1
+ ---
2
+ description: 'Disallow `this` keywords outside of classes or class-like objects.'
3
+ ---
4
+
5
+ > 🛑 This file is source code, not the primary documentation location! 🛑
6
+ >
7
+ > See **https://typescript-eslint.io/rules/no-invalid-this** for documentation.
8
+
9
+ ## Examples
10
+
11
+ This rule extends the base [`eslint/no-invalid-this`](https://eslint.org/docs/rules/no-invalid-this) rule.
12
+ It adds support for TypeScript's `this` parameters.
@@ -0,0 +1,113 @@
1
+ ---
2
+ description: 'Disallow `void` type outside of generic or return types.'
3
+ ---
4
+
5
+ > 🛑 This file is source code, not the primary documentation location! 🛑
6
+ >
7
+ > See **https://typescript-eslint.io/rules/no-invalid-void-type** for documentation.
8
+
9
+ `void` in TypeScript refers to a function return that is meant to be ignored.
10
+ Attempting to use a `void` type outside of a return type or generic type argument is often a sign of programmer error.
11
+ `void` can also be misleading for other developers even if used correctly.
12
+
13
+ > The `void` type means cannot be mixed with any other types, other than `never`, which accepts all types.
14
+ > If you think you need this then you probably want the `undefined` type instead.
15
+
16
+ ## Examples
17
+
18
+ <!--tabs-->
19
+
20
+ ### ❌ Incorrect
21
+
22
+ ```ts
23
+ type PossibleValues = string | number | void;
24
+ type MorePossibleValues = string | ((number & any) | (string | void));
25
+
26
+ function logSomething(thing: void) {}
27
+ function printArg<T = void>(arg: T) {}
28
+
29
+ logAndReturn<void>(undefined);
30
+
31
+ interface Interface {
32
+ lambda: () => void;
33
+ prop: void;
34
+ }
35
+
36
+ class MyClass {
37
+ private readonly propName: void;
38
+ }
39
+ ```
40
+
41
+ ### ✅ Correct
42
+
43
+ ```ts
44
+ type NoOp = () => void;
45
+
46
+ function noop(): void {}
47
+
48
+ let trulyUndefined = void 0;
49
+
50
+ async function promiseMeSomething(): Promise<void> {}
51
+
52
+ type stillVoid = void | never;
53
+ ```
54
+
55
+ ## Options
56
+
57
+ ### `allowInGenericTypeArguments`
58
+
59
+ This option lets you control if `void` can be used as a valid value for generic type parameters.
60
+
61
+ Alternatively, you can provide an array of strings which whitelist which types may accept `void` as a generic type parameter.
62
+
63
+ Any types considered valid by this option will be considered valid as part of a union type with `void`.
64
+
65
+ This option is `true` by default.
66
+
67
+ The following patterns are considered warnings with `{ allowInGenericTypeArguments: false }`:
68
+
69
+ ```ts
70
+ logAndReturn<void>(undefined);
71
+
72
+ let voidPromise: Promise<void> = new Promise<void>(() => {});
73
+ let voidMap: Map<string, void> = new Map<string, void>();
74
+ ```
75
+
76
+ The following patterns are considered warnings with `{ allowInGenericTypeArguments: ['Ex.Mx.Tx'] }`:
77
+
78
+ ```ts
79
+ logAndReturn<void>(undefined);
80
+
81
+ type NotAllowedVoid1 = Mx.Tx<void>;
82
+ type NotAllowedVoid2 = Tx<void>;
83
+ type NotAllowedVoid3 = Promise<void>;
84
+ ```
85
+
86
+ The following patterns are not considered warnings with `{ allowInGenericTypeArguments: ['Ex.Mx.Tx'] }`:
87
+
88
+ ```ts
89
+ type AllowedVoid = Ex.Mx.Tx<void>;
90
+ type AllowedVoidUnion = void | Ex.Mx.Tx<void>;
91
+ ```
92
+
93
+ ### `allowAsThisParameter`
94
+
95
+ This option allows specifying a `this` parameter of a function to be `void` when set to `true`.
96
+ This pattern can be useful to explicitly label function types that do not use a `this` argument. [See the TypeScript docs for more information](https://www.typescriptlang.org/docs/handbook/functions.html#this-parameters-in-callbacks).
97
+
98
+ This option is `false` by default.
99
+
100
+ The following patterns are considered warnings with `{ allowAsThisParameter: false }` but valid with `{ allowAsThisParameter: true }`:
101
+
102
+ ```ts
103
+ function doThing(this: void) {}
104
+ class Example {
105
+ static helper(this: void) {}
106
+ callback(this: void) {}
107
+ }
108
+ ```
109
+
110
+ ## When Not To Use It
111
+
112
+ If you don't care about if `void` is used with other types,
113
+ or in invalid places, then you don't need this rule.
@@ -0,0 +1,12 @@
1
+ ---
2
+ description: 'Disallow function declarations that contain unsafe references inside loop statements.'
3
+ ---
4
+
5
+ > 🛑 This file is source code, not the primary documentation location! 🛑
6
+ >
7
+ > See **https://typescript-eslint.io/rules/no-loop-func** for documentation.
8
+
9
+ ## Examples
10
+
11
+ This rule extends the base [`eslint/no-loop-func`](https://eslint.org/docs/rules/no-loop-func) rule.
12
+ It adds support for TypeScript types.
@@ -0,0 +1,12 @@
1
+ ---
2
+ description: 'Disallow literal numbers that lose precision.'
3
+ ---
4
+
5
+ > 🛑 This file is source code, not the primary documentation location! 🛑
6
+ >
7
+ > See **https://typescript-eslint.io/rules/no-loss-of-precision** for documentation.
8
+
9
+ ## Examples
10
+
11
+ This rule extends the base [`eslint/no-loss-of-precision`](https://eslint.org/docs/rules/no-loss-of-precision) rule.
12
+ It adds support for [numeric separators](https://github.com/tc39/proposal-numeric-separator).
@@ -0,0 +1,131 @@
1
+ ---
2
+ description: 'Disallow magic numbers.'
3
+ ---
4
+
5
+ > 🛑 This file is source code, not the primary documentation location! 🛑
6
+ >
7
+ > See **https://typescript-eslint.io/rules/no-magic-numbers** for documentation.
8
+
9
+ ## Examples
10
+
11
+ This rule extends the base [`eslint/no-magic-numbers`](https://eslint.org/docs/rules/no-magic-numbers) rule.
12
+ It adds support for:
13
+
14
+ - numeric literal types (`type T = 1`),
15
+ - `enum` members (`enum Foo { bar = 1 }`),
16
+ - `readonly` class properties (`class Foo { readonly bar = 1 }`).
17
+
18
+ ## Options
19
+
20
+ This rule adds the following options:
21
+
22
+ ```ts
23
+ interface Options extends BaseNoMagicNumbersOptions {
24
+ ignoreEnums?: boolean;
25
+ ignoreNumericLiteralTypes?: boolean;
26
+ ignoreReadonlyClassProperties?: boolean;
27
+ ignoreTypeIndexes?: boolean;
28
+ }
29
+
30
+ const defaultOptions: Options = {
31
+ ...baseNoMagicNumbersDefaultOptions,
32
+ ignoreEnums: false,
33
+ ignoreNumericLiteralTypes: false,
34
+ ignoreReadonlyClassProperties: false,
35
+ ignoreTypeIndexes: false,
36
+ };
37
+ ```
38
+
39
+ ### `ignoreEnums`
40
+
41
+ A boolean to specify if enums used in TypeScript are considered okay. `false` by default.
42
+
43
+ Examples of **incorrect** code for the `{ "ignoreEnums": false }` option:
44
+
45
+ ```ts
46
+ /*eslint @typescript-eslint/no-magic-numbers: ["error", { "ignoreEnums": false }]*/
47
+
48
+ enum foo {
49
+ SECOND = 1000,
50
+ }
51
+ ```
52
+
53
+ Examples of **correct** code for the `{ "ignoreEnums": true }` option:
54
+
55
+ ```ts
56
+ /*eslint @typescript-eslint/no-magic-numbers: ["error", { "ignoreEnums": true }]*/
57
+
58
+ enum foo {
59
+ SECOND = 1000,
60
+ }
61
+ ```
62
+
63
+ ### `ignoreNumericLiteralTypes`
64
+
65
+ A boolean to specify if numbers used in TypeScript numeric literal types are considered okay. `false` by default.
66
+
67
+ Examples of **incorrect** code for the `{ "ignoreNumericLiteralTypes": false }` option:
68
+
69
+ ```ts
70
+ /*eslint @typescript-eslint/no-magic-numbers: ["error", { "ignoreNumericLiteralTypes": false }]*/
71
+
72
+ type SmallPrimes = 2 | 3 | 5 | 7 | 11;
73
+ ```
74
+
75
+ Examples of **correct** code for the `{ "ignoreNumericLiteralTypes": true }` option:
76
+
77
+ ```ts
78
+ /*eslint @typescript-eslint/no-magic-numbers: ["error", { "ignoreNumericLiteralTypes": true }]*/
79
+
80
+ type SmallPrimes = 2 | 3 | 5 | 7 | 11;
81
+ ```
82
+
83
+ ### `ignoreReadonlyClassProperties`
84
+
85
+ Examples of **incorrect** code for the `{ "ignoreReadonlyClassProperties": false }` option:
86
+
87
+ ```ts
88
+ /*eslint @typescript-eslint/no-magic-numbers: ["error", { "ignoreReadonlyClassProperties": false }]*/
89
+
90
+ class Foo {
91
+ readonly A = 1;
92
+ readonly B = 2;
93
+ public static readonly C = 1;
94
+ static readonly D = 1;
95
+ }
96
+ ```
97
+
98
+ Examples of **correct** code for the `{ "ignoreReadonlyClassProperties": true }` option:
99
+
100
+ ```ts
101
+ /*eslint @typescript-eslint/no-magic-numbers: ["error", { "ignoreReadonlyClassProperties": true }]*/
102
+
103
+ class Foo {
104
+ readonly A = 1;
105
+ readonly B = 2;
106
+ public static readonly C = 1;
107
+ static readonly D = 1;
108
+ }
109
+ ```
110
+
111
+ ### `ignoreTypeIndexes`
112
+
113
+ A boolean to specify if numbers used to index types are okay. `false` by default.
114
+
115
+ Examples of **incorrect** code for the `{ "ignoreTypeIndexes": false }` option:
116
+
117
+ ```ts
118
+ /*eslint @typescript-eslint/no-magic-numbers: ["error", { "ignoreTypeIndexes": false }]*/
119
+
120
+ type Foo = Bar[0];
121
+ type Baz = Parameters<Foo>[2];
122
+ ```
123
+
124
+ Examples of **correct** code for the `{ "ignoreTypeIndexes": true }` option:
125
+
126
+ ```ts
127
+ /*eslint @typescript-eslint/no-magic-numbers: ["error", { "ignoreTypeIndexes": true }]*/
128
+
129
+ type Foo = Bar[0];
130
+ type Baz = Parameters<Foo>[2];
131
+ ```
@@ -0,0 +1,47 @@
1
+ ---
2
+ description: 'Disallow the `void` operator except when used to discard a value.'
3
+ ---
4
+
5
+ > 🛑 This file is source code, not the primary documentation location! 🛑
6
+ >
7
+ > See **https://typescript-eslint.io/rules/no-meaningless-void-operator** for documentation.
8
+
9
+ `void` in TypeScript refers to a function return that is meant to be ignored.
10
+ The `void` operator is a useful tool to convey the programmer's intent to discard a value.
11
+ For example, it is recommended as one way of suppressing [`@typescript-eslint/no-floating-promises`](./no-floating-promises.md) instead of adding `.catch()` to a promise.
12
+
13
+ This rule helps an authors catch API changes where previously a value was being discarded at a call site, but the callee changed so it no longer returns a value.
14
+ When combined with [no-unused-expressions](https://eslint.org/docs/rules/no-unused-expressions), it also helps _readers_ of the code by ensuring consistency: a statement that looks like `void foo();` is **always** discarding a return value, and a statement that looks like `foo();` is **never** discarding a return value.
15
+ This rule reports on any `void` operator whose argument is already of type `void` or `undefined`.
16
+
17
+ ## Examples
18
+
19
+ <!--tabs-->
20
+
21
+ ### ❌ Incorrect
22
+
23
+ ```ts
24
+ void (() => {})();
25
+
26
+ function foo() {}
27
+ void foo();
28
+ ```
29
+
30
+ ### ✅ Correct
31
+
32
+ ```ts
33
+ (() => {})();
34
+
35
+ function foo() {}
36
+ foo(); // nothing to discard
37
+
38
+ function bar(x: number) {
39
+ void x; // discarding a number
40
+ return 2;
41
+ }
42
+ void bar(); // discarding a number
43
+ ```
44
+
45
+ ## Options
46
+
47
+ `checkNever: true` will suggest removing `void` when the argument has type `never`.