@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,706 @@
1
+ ---
2
+ description: 'Enforce naming conventions for everything across a codebase.'
3
+ ---
4
+
5
+ > 🛑 This file is source code, not the primary documentation location! 🛑
6
+ >
7
+ > See **https://typescript-eslint.io/rules/naming-convention** for documentation.
8
+
9
+ Enforcing naming conventions helps keep the codebase consistent, and reduces overhead when thinking about how to name a variable.
10
+ Additionally, a well-designed style guide can help communicate intent, such as by enforcing all private properties begin with an `_`, and all global-level constants are written in `UPPER_CASE`.
11
+
12
+ ## Examples
13
+
14
+ This rule allows you to enforce conventions for any identifier, using granular selectors to create a fine-grained style guide.
15
+
16
+ :::note
17
+
18
+ This rule only needs type information in specific cases, detailed below.
19
+
20
+ :::
21
+
22
+ ## Options
23
+
24
+ This rule accepts an array of objects, with each object describing a different naming convention.
25
+ Each property will be described in detail below. Also see the examples section below for illustrated examples.
26
+
27
+ ```ts
28
+ type Options = {
29
+ // format options
30
+ format:
31
+ | (
32
+ | 'camelCase'
33
+ | 'strictCamelCase'
34
+ | 'PascalCase'
35
+ | 'StrictPascalCase'
36
+ | 'snake_case'
37
+ | 'UPPER_CASE'
38
+ )[]
39
+ | null;
40
+ custom?: {
41
+ regex: string;
42
+ match: boolean;
43
+ };
44
+ leadingUnderscore?:
45
+ | 'forbid'
46
+ | 'require'
47
+ | 'requireDouble'
48
+ | 'allow'
49
+ | 'allowDouble'
50
+ | 'allowSingleOrDouble';
51
+ trailingUnderscore?:
52
+ | 'forbid'
53
+ | 'require'
54
+ | 'requireDouble'
55
+ | 'allow'
56
+ | 'allowDouble'
57
+ | 'allowSingleOrDouble';
58
+ prefix?: string[];
59
+ suffix?: string[];
60
+
61
+ // selector options
62
+ selector: Selector | Selector[];
63
+ filter?:
64
+ | string
65
+ | {
66
+ regex: string;
67
+ match: boolean;
68
+ };
69
+ // the allowed values for these are dependent on the selector - see below
70
+ modifiers?: Modifiers<Selector>[];
71
+ types?: Types<Selector>[];
72
+ }[];
73
+
74
+ // the default config is similar to ESLint's camelcase rule but more strict
75
+ const defaultOptions: Options = [
76
+ {
77
+ selector: 'default',
78
+ format: ['camelCase'],
79
+ leadingUnderscore: 'allow',
80
+ trailingUnderscore: 'allow',
81
+ },
82
+
83
+ {
84
+ selector: 'variable',
85
+ format: ['camelCase', 'UPPER_CASE'],
86
+ leadingUnderscore: 'allow',
87
+ trailingUnderscore: 'allow',
88
+ },
89
+
90
+ {
91
+ selector: 'typeLike',
92
+ format: ['PascalCase'],
93
+ },
94
+ ];
95
+ ```
96
+
97
+ ### Format Options
98
+
99
+ Every single selector can have the same set of format options.
100
+ For information about how each selector is applied, see ["How does the rule evaluate a name's format?"](#how-does-the-rule-evaluate-a-names-format).
101
+
102
+ #### `format`
103
+
104
+ The `format` option defines the allowed formats for the identifier. This option accepts an array of the following values, and the identifier can match any of them:
105
+
106
+ - `camelCase` - standard camelCase format - no underscores are allowed between characters, and consecutive capitals are allowed (i.e. both `myID` and `myId` are valid).
107
+ - `PascalCase` - same as `camelCase`, except the first character must be upper-case.
108
+ - `snake_case` - standard snake_case format - all characters must be lower-case, and underscores are allowed.
109
+ - `strictCamelCase` - same as `camelCase`, but consecutive capitals are not allowed (i.e. `myId` is valid, but `myID` is not).
110
+ - `StrictPascalCase` - same as `strictCamelCase`, except the first character must be upper-case.
111
+ - `UPPER_CASE` - same as `snake_case`, except all characters must be upper-case.
112
+
113
+ Instead of an array, you may also pass `null`. This signifies "this selector shall not have its format checked".
114
+ This can be useful if you want to enforce no particular format for a specific selector, after applying a group selector.
115
+
116
+ #### `custom`
117
+
118
+ The `custom` option defines a custom regex that the identifier must (or must not) match. This option allows you to have a bit more finer-grained control over identifiers, letting you ban (or force) certain patterns and substrings.
119
+ Accepts an object with the following properties:
120
+
121
+ - `match` - true if the identifier _must_ match the `regex`, false if the identifier _must not_ match the `regex`.
122
+ - `regex` - a string that is then passed into RegExp to create a new regular expression: `new RegExp(regex)`
123
+
124
+ #### `filter`
125
+
126
+ The `filter` option operates similar to `custom`, accepting the same shaped object, except that it controls if the rest of the configuration should or should not be applied to an identifier.
127
+
128
+ You can use this to include or exclude specific identifiers from specific configurations.
129
+
130
+ Accepts an object with the following properties:
131
+
132
+ - `match` - true if the identifier _must_ match the `regex`, false if the identifier _must not_ match the `regex`.
133
+ - `regex` - a string that is then passed into RegExp to create a new regular expression: `new RegExp(regex)`
134
+
135
+ Alternatively, `filter` accepts a regular expression (anything accepted into `new RegExp(filter)`). In this case, it's treated as if you had passed an object with the regex and `match: true`.
136
+
137
+ #### `leadingUnderscore` / `trailingUnderscore`
138
+
139
+ The `leadingUnderscore` / `trailingUnderscore` options control whether leading/trailing underscores are considered valid. Accepts one of the following values:
140
+
141
+ - `allow` - existence of a single leading/trailing underscore is not explicitly enforced.
142
+ - `allowDouble` - existence of a double leading/trailing underscore is not explicitly enforced.
143
+ - `allowSingleOrDouble` - existence of a single or a double leading/trailing underscore is not explicitly enforced.
144
+ - `forbid` - a leading/trailing underscore is not allowed at all.
145
+ - `require` - a single leading/trailing underscore must be included.
146
+ - `requireDouble` - two leading/trailing underscores must be included.
147
+
148
+ #### `prefix` / `suffix`
149
+
150
+ The `prefix` / `suffix` options control which prefix/suffix strings must exist for the identifier. Accepts an array of strings.
151
+
152
+ If these are provided, the identifier must start with one of the provided values. For example, if you provide `{ prefix: ['Class', 'IFace', 'Type'] }`, then the following names are valid: `ClassBar`, `IFaceFoo`, `TypeBaz`, but the name `Bang` is not valid, as it contains none of the prefixes.
153
+
154
+ **Note:** As [documented above](#format-options), the prefix is trimmed before format is validated, therefore PascalCase must be used to allow variables such as `isEnabled` using the prefix `is`.
155
+
156
+ ### Selector Options
157
+
158
+ - `selector` allows you to specify what types of identifiers to target.
159
+ - Accepts one or array of selectors to define an option block that applies to one or multiple selectors.
160
+ - For example, if you provide `{ selector: ['function', 'variable'] }`, then it will apply the same option to variable and function nodes.
161
+ - See [Allowed Selectors, Modifiers and Types](#allowed-selectors-modifiers-and-types) below for the complete list of allowed selectors.
162
+ - `modifiers` allows you to specify which modifiers to granularly apply to, such as the accessibility (`#private`/`private`/`protected`/`public`), or if the thing is `static`, etc.
163
+ - The name must match _all_ of the modifiers.
164
+ - For example, if you provide `{ modifiers: ['private','readonly','static'] }`, then it will only match something that is `private static readonly`, and something that is just `private` will not match.
165
+ - The following `modifiers` are allowed:
166
+ - `abstract`,`override`,`private`,`protected`,`readonly`,`static` - matches any member explicitly declared with the given modifier.
167
+ - `async` - matches any method, function, or function variable which is async via the `async` keyword (e.g. does not match functions that return promises without using `async` keyword)
168
+ - `const` - matches a variable declared as being `const` (`const x = 1`).
169
+ - `destructured` - matches a variable declared via an object destructuring pattern (`const {x, z = 2}`).
170
+ - Note that this does not match renamed destructured properties (`const {x: y, a: b = 2}`).
171
+ - `exported` - matches anything that is exported from the module.
172
+ - `global` - matches a variable/function declared in the top-level scope.
173
+ - `#private` - matches any member with a private identifier (an identifier that starts with `#`)
174
+ - `public` - matches any member that is either explicitly declared as `public`, or has no visibility modifier (i.e. implicitly public).
175
+ - `requiresQuotes` - matches any name that requires quotes as it is not a valid identifier (i.e. has a space, a dash, etc in it).
176
+ - `unused` - matches anything that is not used.
177
+ - `types` allows you to specify which types to match. This option supports simple, primitive types only (`array`,`boolean`,`function`,`number`,`string`).
178
+ - The name must match _one_ of the types.
179
+ - **_NOTE - Using this option will require that you lint with type information._**
180
+ - For example, this lets you do things like enforce that `boolean` variables are prefixed with a verb.
181
+ - The following `types` are allowed:
182
+ - `array` matches any type assignable to `Array<unknown> | null | undefined`
183
+ - `boolean` matches any type assignable to `boolean | null | undefined`
184
+ - `function` matches any type assignable to `Function | null | undefined`
185
+ - `number` matches any type assignable to `number | null | undefined`
186
+ - `string` matches any type assignable to `string | null | undefined`
187
+
188
+ The ordering of selectors does not matter. The implementation will automatically sort the selectors to ensure they match from most-specific to least specific. It will keep checking selectors in that order until it finds one that matches the name. See ["How does the rule automatically order selectors?"](#how-does-the-rule-automatically-order-selectors)
189
+
190
+ #### Allowed Selectors, Modifiers and Types
191
+
192
+ There are two types of selectors, individual selectors, and grouped selectors.
193
+
194
+ ##### Individual Selectors
195
+
196
+ Individual Selectors match specific, well-defined sets. There is no overlap between each of the individual selectors.
197
+
198
+ - `accessor` - matches any accessor.
199
+ - Allowed `modifiers`: `abstract`, `override`, `private`, `protected`, `public`, `requiresQuotes`, `static`.
200
+ - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`.
201
+ - `class` - matches any class declaration.
202
+ - Allowed `modifiers`: `abstract`, `exported`, `unused`.
203
+ - Allowed `types`: none.
204
+ - `classMethod` - matches any class method. Also matches properties that have direct function expression or arrow function expression values. Does not match accessors.
205
+ - Allowed `modifiers`: `abstract`, `async`, `override`, `#private`, `private`, `protected`, `public`, `requiresQuotes`, `static`.
206
+ - Allowed `types`: none.
207
+ - `classProperty` - matches any class property. Does not match properties that have direct function expression or arrow function expression values.
208
+ - Allowed `modifiers`: `abstract`, `override`, `#private`, `private`, `protected`, `public`, `readonly`, `requiresQuotes`, `static`.
209
+ - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`.
210
+ - `enum` - matches any enum declaration.
211
+ - Allowed `modifiers`: `exported`, `unused`.
212
+ - Allowed `types`: none.
213
+ - `enumMember` - matches any enum member.
214
+ - Allowed `modifiers`: `requiresQuotes`.
215
+ - Allowed `types`: none.
216
+ - `function` - matches any named function declaration or named function expression.
217
+ - Allowed `modifiers`: `async`, `exported`, `global`, `unused`.
218
+ - Allowed `types`: none.
219
+ - `interface` - matches any interface declaration.
220
+ - Allowed `modifiers`: `exported`, `unused`.
221
+ - Allowed `types`: none.
222
+ - `objectLiteralMethod` - matches any object literal method. Also matches properties that have direct function expression or arrow function expression values. Does not match accessors.
223
+ - Allowed `modifiers`: `async`, `public`, `requiresQuotes`.
224
+ - Allowed `types`: none.
225
+ - `objectLiteralProperty` - matches any object literal property. Does not match properties that have direct function expression or arrow function expression values.
226
+ - Allowed `modifiers`: `public`, `requiresQuotes`.
227
+ - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`.
228
+ - `parameter` - matches any function parameter. Does not match parameter properties.
229
+ - Allowed `modifiers`: `destructured`, `unused`.
230
+ - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`.
231
+ - `parameterProperty` - matches any parameter property.
232
+ - Allowed `modifiers`: `private`, `protected`, `public`, `readonly`.
233
+ - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`.
234
+ - `typeAlias` - matches any type alias declaration.
235
+ - Allowed `modifiers`: `exported`, `unused`.
236
+ - Allowed `types`: none.
237
+ - `typeMethod` - matches any object type method. Also matches properties that have direct function expression or arrow function expression values. Does not match accessors.
238
+ - Allowed `modifiers`: `public`, `requiresQuotes`.
239
+ - Allowed `types`: none.
240
+ - `typeParameter` - matches any generic type parameter declaration.
241
+ - Allowed `modifiers`: `unused`.
242
+ - Allowed `types`: none.
243
+ - `typeProperty` - matches any object type property. Does not match properties that have direct function expression or arrow function expression values.
244
+ - Allowed `modifiers`: `public`, `readonly`, `requiresQuotes`.
245
+ - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`.
246
+ - `variable` - matches any `const` / `let` / `var` variable name.
247
+ - Allowed `modifiers`: `async`, `const`, `destructured`, `exported`, `global`, `unused`.
248
+ - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`.
249
+
250
+ ##### Group Selectors
251
+
252
+ Group Selectors are provided for convenience, and essentially bundle up sets of individual selectors.
253
+
254
+ - `default` - matches everything.
255
+ - Allowed `modifiers`: all modifiers.
256
+ - Allowed `types`: none.
257
+ - `memberLike` - matches the same as `accessor`, `enumMember`, `method`, `parameterProperty`, `property`.
258
+ - Allowed `modifiers`: `abstract`, `async`, `override`, `#private`, `private`, `protected`, `public`, `readonly`, `requiresQuotes`, `static`.
259
+ - Allowed `types`: none.
260
+ - `method` - matches the same as `classMethod`, `objectLiteralMethod`, `typeMethod`.
261
+ - Allowed `modifiers`: `abstract`, `async`, `override`, `#private`, `private`, `protected`, `public`, `readonly`, `requiresQuotes`, `static`.
262
+ - Allowed `types`: none.
263
+ - `property` - matches the same as `classProperty`, `objectLiteralProperty`, `typeProperty`.
264
+ - Allowed `modifiers`: `abstract`, `async`, `override`, `#private`, `private`, `protected`, `public`, `readonly`, `requiresQuotes`, `static`.
265
+ - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`.
266
+ - `typeLike` - matches the same as `class`, `enum`, `interface`, `typeAlias`, `typeParameter`.
267
+ - Allowed `modifiers`: `abstract`, `unused`.
268
+ - Allowed `types`: none.
269
+ - `variableLike` - matches the same as `function`, `parameter` and `variable`.
270
+ - Allowed `modifiers`: `async`, `unused`.
271
+ - Allowed `types`: none.
272
+
273
+ ## FAQ
274
+
275
+ This is a big rule, and there's a lot of docs. Here are a few clarifications that people often ask about or figure out via trial-and-error.
276
+
277
+ ### How does the rule evaluate a selector?
278
+
279
+ Each selector is checked in the following way:
280
+
281
+ 1. check the `filter`
282
+ 1. if `filter` is omitted → skip this step.
283
+ 2. if the name matches the `filter` → continue evaluating this selector.
284
+ 3. if the name does not match the `filter` → skip this selector and continue to the next selector.
285
+ 2. check the `selector`
286
+ 1. if `selector` is one individual selector → the name's type must be of that type.
287
+ 2. if `selector` is a group selector → the name's type must be one of the grouped types.
288
+ 3. if `selector` is an array of selectors → apply the above for each selector in the array.
289
+ 3. check the `types`
290
+ 1. if `types` is omitted → skip this step.
291
+ 2. if the name has a type in `types` → continue evaluating this selector.
292
+ 3. if the name does not have a type in `types` → skip this selector and continue to the next selector.
293
+
294
+ A name is considered to pass the config if it:
295
+
296
+ 1. Matches one selector and passes all of that selector's format checks.
297
+ 2. Matches no selectors.
298
+
299
+ A name is considered to fail the config if it matches one selector and fails one that selector's format checks.
300
+
301
+ ### How does the rule automatically order selectors?
302
+
303
+ Each identifier should match exactly one selector. It may match multiple group selectors - but only ever one selector.
304
+ With that in mind - the base sort order works out to be:
305
+
306
+ 1. Individual Selectors
307
+ 2. Grouped Selectors
308
+ 3. Default Selector
309
+
310
+ Within each of these categories, some further sorting occurs based on what selector options are supplied:
311
+
312
+ 1. `filter` is given the highest priority above all else.
313
+ 2. `types`
314
+ 3. `modifiers`
315
+ 4. everything else
316
+
317
+ For example, if you provide the following config:
318
+
319
+ ```ts
320
+ [
321
+ /* 1 */ { selector: 'default', format: ['camelCase'] },
322
+ /* 2 */ { selector: 'variable', format: ['snake_case'] },
323
+ /* 3 */ { selector: 'variable', types: ['boolean'], format: ['UPPER_CASE'] },
324
+ /* 4 */ { selector: 'variableLike', format: ['PascalCase'] },
325
+ ];
326
+ ```
327
+
328
+ Then for the code `const x = 1`, the rule will validate the selectors in the following order: `3`, `2`, `4`, `1`.
329
+ To clearly spell it out:
330
+
331
+ - (3) is tested first because it has `types` and is an individual selector.
332
+ - (2) is tested next because it is an individual selector.
333
+ - (4) is tested next as it is a grouped selector.
334
+ - (1) is tested last as it is the base default selector.
335
+
336
+ Its worth noting that whilst this order is applied, all selectors may not run on a name.
337
+ This is explained in ["How does the rule evaluate a name's format?"](#how-does-the-rule-evaluate-a-names-format)
338
+
339
+ ### How does the rule evaluate a name's format?
340
+
341
+ When the format of an identifier is checked, it is checked in the following order:
342
+
343
+ 1. validate leading underscore
344
+ 1. validate trailing underscore
345
+ 1. validate prefix
346
+ 1. validate suffix
347
+ 1. validate custom
348
+ 1. validate format
349
+
350
+ For steps 1-4, if the identifier matches the option, the matching part will be removed.
351
+ This is done so that you can apply formats like PascalCase without worrying about prefixes or underscores causing it to not match.
352
+
353
+ One final note is that if the name were to become empty via this trimming process, it is considered to match all `format`s. An example of where this might be useful is for generic type parameters, where you want all names to be prefixed with `T`, but also want to allow for the single character `T` name.
354
+
355
+ Here are some examples to help illustrate
356
+
357
+ Name: `_IMyInterface`
358
+ Selector:
359
+
360
+ ```json
361
+ {
362
+ "leadingUnderscore": "require",
363
+ "prefix": ["I"],
364
+ "format": ["UPPER_CASE", "StrictPascalCase"]
365
+ }
366
+ ```
367
+
368
+ 1. `name = _IMyInterface`
369
+ 1. validate leading underscore
370
+ 1. config is provided
371
+ 1. check name → pass
372
+ 1. Trim underscore → `name = IMyInterface`
373
+ 1. validate trailing underscore
374
+ 1. config is not provided → skip
375
+ 1. validate prefix
376
+ 1. config is provided
377
+ 1. check name → pass
378
+ 1. Trim prefix → `name = MyInterface`
379
+ 1. validate suffix
380
+ 1. config is not provided → skip
381
+ 1. validate custom
382
+ 1. config is not provided → skip
383
+ 1. validate format
384
+ 1. for each format...
385
+ 1. `format = 'UPPER_CASE'`
386
+ 1. check format → fail.
387
+ - Important to note that if you supply multiple formats - the name only needs to match _one_ of them!
388
+ 1. `format = 'StrictPascalCase'`
389
+ 1. check format → success.
390
+ 1. **_success_**
391
+
392
+ Name: `IMyInterface`
393
+ Selector:
394
+
395
+ ```json
396
+ {
397
+ "format": ["StrictPascalCase"],
398
+ "trailingUnderscore": "allow",
399
+ "custom": {
400
+ "regex": "^I[A-Z]",
401
+ "match": false
402
+ }
403
+ }
404
+ ```
405
+
406
+ 1. `name = IMyInterface`
407
+ 1. validate leading underscore
408
+ 1. config is not provided → skip
409
+ 1. validate trailing underscore
410
+ 1. config is provided
411
+ 1. check name → pass
412
+ 1. Trim underscore → `name = IMyInterface`
413
+ 1. validate prefix
414
+ 1. config is not provided → skip
415
+ 1. validate suffix
416
+ 1. config is not provided → skip
417
+ 1. validate custom
418
+ 1. config is provided
419
+ 1. `regex = new RegExp("^I[A-Z]")`
420
+ 1. `regex.test(name) === custom.match`
421
+ 1. **_fail_** → report and exit
422
+
423
+ ### What happens if I provide a `modifiers` to a Group Selector?
424
+
425
+ Some group selectors accept `modifiers`. For the most part these will work exactly the same as with individual selectors.
426
+ There is one exception to this in that a modifier might not apply to all individual selectors covered by a group selector.
427
+
428
+ For example - `memberLike` includes the `enumMember` selector, and it allows the `protected` modifier.
429
+ An `enumMember` can never ever be `protected`, which means that the following config will never match any `enumMember`:
430
+
431
+ ```json
432
+ {
433
+ "selector": "memberLike",
434
+ "modifiers": ["protected"]
435
+ }
436
+ ```
437
+
438
+ To help with matching, members that cannot specify an accessibility will always have the `public` modifier. This means that the following config will always match any `enumMember`:
439
+
440
+ ```json
441
+ {
442
+ "selector": "memberLike",
443
+ "modifiers": ["public"]
444
+ }
445
+ ```
446
+
447
+ ## Examples
448
+
449
+ ### Enforce that all variables, functions and properties follow are camelCase
450
+
451
+ ```json
452
+ {
453
+ "@typescript-eslint/naming-convention": [
454
+ "error",
455
+ { "selector": "variableLike", "format": ["camelCase"] }
456
+ ]
457
+ }
458
+ ```
459
+
460
+ ### Enforce that private members are prefixed with an underscore
461
+
462
+ ```json
463
+ {
464
+ "@typescript-eslint/naming-convention": [
465
+ "error",
466
+ {
467
+ "selector": "memberLike",
468
+ "modifiers": ["private"],
469
+ "format": ["camelCase"],
470
+ "leadingUnderscore": "require"
471
+ }
472
+ ]
473
+ }
474
+ ```
475
+
476
+ ### Enforce that boolean variables are prefixed with an allowed verb
477
+
478
+ **Note:** As [documented above](#format-options), the prefix is trimmed before format is validated, thus PascalCase must be used to allow variables such as `isEnabled`.
479
+
480
+ ```json
481
+ {
482
+ "@typescript-eslint/naming-convention": [
483
+ "error",
484
+ {
485
+ "selector": "variable",
486
+ "types": ["boolean"],
487
+ "format": ["PascalCase"],
488
+ "prefix": ["is", "should", "has", "can", "did", "will"]
489
+ }
490
+ ]
491
+ }
492
+ ```
493
+
494
+ ### Enforce that all variables are either in camelCase or UPPER_CASE
495
+
496
+ ```json
497
+ {
498
+ "@typescript-eslint/naming-convention": [
499
+ "error",
500
+ {
501
+ "selector": "variable",
502
+ "format": ["camelCase", "UPPER_CASE"]
503
+ }
504
+ ]
505
+ }
506
+ ```
507
+
508
+ ### Enforce that all const variables are in UPPER_CASE
509
+
510
+ ```json
511
+ {
512
+ "@typescript-eslint/naming-convention": [
513
+ "error",
514
+ {
515
+ "selector": "variable",
516
+ "modifiers": ["const"],
517
+ "format": ["UPPER_CASE"]
518
+ }
519
+ ]
520
+ }
521
+ ```
522
+
523
+ ### Enforce that type parameters (generics) are prefixed with `T`
524
+
525
+ This allows you to emulate the old `generic-type-naming` rule.
526
+
527
+ ```json
528
+ {
529
+ "@typescript-eslint/naming-convention": [
530
+ "error",
531
+ {
532
+ "selector": "typeParameter",
533
+ "format": ["PascalCase"],
534
+ "prefix": ["T"]
535
+ }
536
+ ]
537
+ }
538
+ ```
539
+
540
+ ### Enforce that interface names do not begin with an `I`
541
+
542
+ This allows you to emulate the old `interface-name-prefix` rule.
543
+
544
+ ```json
545
+ {
546
+ "@typescript-eslint/naming-convention": [
547
+ "error",
548
+ {
549
+ "selector": "interface",
550
+ "format": ["PascalCase"],
551
+ "custom": {
552
+ "regex": "^I[A-Z]",
553
+ "match": false
554
+ }
555
+ }
556
+ ]
557
+ }
558
+ ```
559
+
560
+ ### Enforce that variable and function names are in camelCase
561
+
562
+ This allows you to lint multiple type with same pattern.
563
+
564
+ ```json
565
+ {
566
+ "@typescript-eslint/naming-convention": [
567
+ "error",
568
+ {
569
+ "selector": ["variable", "function"],
570
+ "format": ["camelCase"],
571
+ "leadingUnderscore": "allow"
572
+ }
573
+ ]
574
+ }
575
+ ```
576
+
577
+ ### Ignore properties that **_require_** quotes
578
+
579
+ Sometimes you have to use a quoted name that breaks the convention (for example, HTTP headers).
580
+ If this is a common thing in your codebase, then you have a few options.
581
+
582
+ If you simply want to allow all property names that require quotes, you can use the `requiresQuotes` modifier to match any property name that _requires_ quoting, and use `format: null` to ignore the name.
583
+
584
+ ```jsonc
585
+ {
586
+ "@typescript-eslint/naming-convention": [
587
+ "error",
588
+ {
589
+ "selector": [
590
+ "classProperty",
591
+ "objectLiteralProperty",
592
+ "typeProperty",
593
+ "classMethod",
594
+ "objectLiteralMethod",
595
+ "typeMethod",
596
+ "accessor",
597
+ "enumMember"
598
+ ],
599
+ "format": null,
600
+ "modifiers": ["requiresQuotes"]
601
+ }
602
+ ]
603
+ }
604
+ ```
605
+
606
+ If you have a small and known list of exceptions, you can use the `filter` option to ignore these specific names only:
607
+
608
+ ```jsonc
609
+ {
610
+ "@typescript-eslint/naming-convention": [
611
+ "error",
612
+ {
613
+ "selector": "property",
614
+ "format": ["strictCamelCase"],
615
+ "filter": {
616
+ // you can expand this regex to add more allowed names
617
+ "regex": "^(Property-Name-One|Property-Name-Two)$",
618
+ "match": false
619
+ }
620
+ }
621
+ ]
622
+ }
623
+ ```
624
+
625
+ You can use the `filter` option to ignore names with specific characters:
626
+
627
+ ```jsonc
628
+ {
629
+ "@typescript-eslint/naming-convention": [
630
+ "error",
631
+ {
632
+ "selector": "property",
633
+ "format": ["strictCamelCase"],
634
+ "filter": {
635
+ // you can expand this regex as you find more cases that require quoting that you want to allow
636
+ "regex": "[- ]",
637
+ "match": false
638
+ }
639
+ }
640
+ ]
641
+ }
642
+ ```
643
+
644
+ Note that there is no way to ignore any name that is quoted - only names that are required to be quoted.
645
+ This is intentional - adding quotes around a name is not an escape hatch for proper naming.
646
+ If you want an escape hatch for a specific name - you should can use an [`eslint-disable` comment](https://eslint.org/docs/user-guide/configuring#disabling-rules-with-inline-comments).
647
+
648
+ ### Ignore destructured names
649
+
650
+ Sometimes you might want to allow destructured properties to retain their original name, even if it breaks your naming convention.
651
+
652
+ You can use the `destructured` modifier to match these names, and explicitly set `format: null` to apply no formatting:
653
+
654
+ ```jsonc
655
+ {
656
+ "@typescript-eslint/naming-convention": [
657
+ "error",
658
+ {
659
+ "selector": "variable",
660
+ "modifiers": ["destructured"],
661
+ "format": null
662
+ }
663
+ ]
664
+ }
665
+ ```
666
+
667
+ ### Enforce the codebase follows ESLint's `camelcase` conventions
668
+
669
+ ```json
670
+ {
671
+ "camelcase": "off",
672
+ "@typescript-eslint/naming-convention": [
673
+ "error",
674
+ {
675
+ "selector": "default",
676
+ "format": ["camelCase"]
677
+ },
678
+
679
+ {
680
+ "selector": "variable",
681
+ "format": ["camelCase", "UPPER_CASE"]
682
+ },
683
+ {
684
+ "selector": "parameter",
685
+ "format": ["camelCase"],
686
+ "leadingUnderscore": "allow"
687
+ },
688
+
689
+ {
690
+ "selector": "memberLike",
691
+ "modifiers": ["private"],
692
+ "format": ["camelCase"],
693
+ "leadingUnderscore": "require"
694
+ },
695
+
696
+ {
697
+ "selector": "typeLike",
698
+ "format": ["PascalCase"]
699
+ }
700
+ ]
701
+ }
702
+ ```
703
+
704
+ ## When Not To Use It
705
+
706
+ If you do not want to enforce naming conventions for anything.