@nr1e/commons 0.1.1-alpha.0 → 0.1.2
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.
- package/package.json +1 -1
- package/.editorconfig +0 -19
- package/.eslintignore +0 -3
- package/.eslintrc.json +0 -4
- package/.git/COMMIT_EDITMSG +0 -5
- package/.git/FETCH_HEAD +0 -1
- package/.git/HEAD +0 -1
- package/.git/config +0 -18
- package/.git/config.worktree +0 -5
- package/.git/description +0 -1
- package/.git/hooks/applypatch-msg.sample +0 -15
- package/.git/hooks/commit-msg.sample +0 -24
- package/.git/hooks/fsmonitor-watchman.sample +0 -174
- package/.git/hooks/post-update.sample +0 -8
- package/.git/hooks/pre-applypatch.sample +0 -14
- package/.git/hooks/pre-commit.sample +0 -49
- package/.git/hooks/pre-merge-commit.sample +0 -13
- package/.git/hooks/pre-push.sample +0 -53
- package/.git/hooks/pre-rebase.sample +0 -169
- package/.git/hooks/pre-receive.sample +0 -24
- package/.git/hooks/prepare-commit-msg.sample +0 -42
- package/.git/hooks/push-to-checkout.sample +0 -78
- package/.git/hooks/sendemail-validate.sample +0 -77
- package/.git/hooks/update.sample +0 -128
- package/.git/index +0 -0
- package/.git/info/exclude +0 -6
- package/.git/logs/HEAD +0 -2
- package/.git/logs/refs/heads/develop +0 -2
- package/.git/logs/refs/remotes/origin/develop +0 -2
- package/.git/objects/07/c0af7cd711cab6a55ad3dc349ac8c70775623c +0 -0
- package/.git/objects/09/8fb5a5ff070a1ee3ea11db1a3568af3fea6fa2 +0 -0
- package/.git/objects/0d/698432e2c44311c17b845cc63093a898972b95 +0 -0
- package/.git/objects/10/ba4a7d64968326293182d571a9c73f5e041fb6 +0 -3
- package/.git/objects/12/069a5aa45479564e00749f730582627a276a55 +0 -3
- package/.git/objects/14/5ab9cf82c40696a07ab42f117ba199acb2a50b +0 -4
- package/.git/objects/17/7b0dc4bf884f8ae0403b4aad053e76baafd632 +0 -2
- package/.git/objects/1d/a517ce3527df45a4f28e52ff2c0d9d1c8179f6 +0 -0
- package/.git/objects/26/d9a4912af870ce319f5cb5102651d49baac4ab +0 -1
- package/.git/objects/27/50076ed23b5211a52ef834f40f183ddecb917a +0 -0
- package/.git/objects/2a/96e4bb57fa4bd69c719dca224b17b569e94e82 +0 -2
- package/.git/objects/2b/38c26b4ec43b8f5574acb164d2ba64bca8e230 +0 -0
- package/.git/objects/2c/61d463bee185f04e7c2bd1d2a15ad1117c589e +0 -0
- package/.git/objects/2d/22dbc836cfd75c8d7640ebe5a4fe90bd2c23c6 +0 -0
- package/.git/objects/38/0be191ee415827a1217f46626fea4fefba48e5 +0 -0
- package/.git/objects/4c/bb28de66d7aaeb4d7737cc2be955adc0c886b5 +0 -0
- package/.git/objects/50/150b739272269be2ede552448013eba65323da +0 -0
- package/.git/objects/53/2b7b796ffd3223f913a5a5e1e17743ee3591fe +0 -0
- package/.git/objects/54/f13d9d62fbedd19b41134ba17153c4328de95b +0 -0
- package/.git/objects/5d/4aa0709f62f1bc1fa80251208b570cb3b89d9c +0 -0
- package/.git/objects/63/1c43e00d4c34ba914c510f4fe2e6df15b8b06e +0 -0
- package/.git/objects/63/9900d13c6182e452e33a3bd638e70a0146c785 +0 -2
- package/.git/objects/64/3fa02661c3a1b54205729a75d2fb5f013833af +0 -0
- package/.git/objects/6c/59086d862516d2fffa5da2035e5003100fb5c7 +0 -0
- package/.git/objects/6c/b74f90a0c799eea1c54a04d8d6a8a9e9691cca +0 -2
- package/.git/objects/6d/f39e776d6a89628ce4a005a011911298651635 +0 -0
- package/.git/objects/70/0e093acb1c1e55d523507411b7940a01a3bb65 +0 -0
- package/.git/objects/74/c82ffe8eb71efecbccfdf67b590949c944dd1a +0 -0
- package/.git/objects/76/1413a07839108abb46ef0e4490bd1c1444b4fc +0 -0
- package/.git/objects/77/96f8282f2c553ecdde72bc976478eb3a8a948e +0 -0
- package/.git/objects/79/ee123c2b23e069e35ed634d687e17f731cc702 +0 -0
- package/.git/objects/7d/80af9735f0527db35ecc79ae3c887e445cb3e0 +0 -0
- package/.git/objects/85/1d8d26c2a946ccfd5461a2573665c1fb7d71f7 +0 -0
- package/.git/objects/85/c5f24b8c55496f82a2680f94a7d3fa32887ea0 +0 -0
- package/.git/objects/87/00b3833597b600e6f0ffcfbaf622fd8cfaa9c3 +0 -1
- package/.git/objects/87/f31d3df8e7edbf96e45d80126f878b8e0c243f +0 -0
- package/.git/objects/8d/d819967bdc8457f04c1b5498bce89380d6552b +0 -7
- package/.git/objects/92/608c4e069a4301d466d8d18daecbe7abc9500e +0 -0
- package/.git/objects/94/a25f7f4cb416c083d265558da75d457237d671 +0 -0
- package/.git/objects/9c/69411050eac81b5dce09314516a30b38c41a20 +0 -3
- package/.git/objects/9f/54b5b21769da383f12fb9c7bd364bdb05e13a9 +0 -0
- package/.git/objects/a5/886c22eb68b152bb95ec5151504676d8e78ae1 +0 -0
- package/.git/objects/a6/582c9510e264f3b46fc3b20597a16923a03523 +0 -0
- package/.git/objects/a9/d7db9c0a81b2db47ca92e4e180b30090b27632 +0 -0
- package/.git/objects/aa/8ae6a0af7014d738cc551d1ffebeb4e19e6b73 +0 -0
- package/.git/objects/ad/c418f9105db9ec488de6831584b82e3929eaef +0 -0
- package/.git/objects/ae/14b04cdf65ade0f70577cdea2f85203f4c1bde +0 -0
- package/.git/objects/b0/c1c68fbbad6b190434cd2bb0e807796bd56fca +0 -0
- package/.git/objects/b1/0f0d0ef3bc5aaf3a91be0b991cb6fe0fcadc40 +0 -0
- package/.git/objects/b1/3c15806ef3856ecd8660b0bb36f39830daa3c2 +0 -0
- package/.git/objects/b6/3b642cfb4254fc0f7058903abc5b481895c4ef +0 -0
- package/.git/objects/b8/a2c461d7ffed9d4ba242c58a52341832b99e0a +0 -0
- package/.git/objects/bc/91e0079eb00d56dcde16714748f36a10dbd525 +0 -0
- package/.git/objects/c1/beeb895b71b709e48560460199db11b3fc18af +0 -0
- package/.git/objects/c5/166c2aeebaeb0a0f7654223c843c50cd4c8953 +0 -0
- package/.git/objects/d4/0a2096fc36c1fd9c7a9263c458d5e8a4a5bee7 +0 -0
- package/.git/objects/e8/019be9e978a8e2f094e748cbb6ce0c7163adee +0 -0
- package/.git/objects/eb/1d744c4e9b47bc902647298424320078e32980 +0 -0
- package/.git/objects/ee/15af38be7f3c3862229e59c6b5688f8e0f6099 +0 -0
- package/.git/objects/f1/9e0f429f231c34432784f9e33b92ac1d598c17 +0 -0
- package/.git/objects/f9/86f2fe82493e85651396b6d5886316d1c890dd +0 -0
- package/.git/refs/heads/develop +0 -1
- package/.git/refs/remotes/origin/develop +0 -1
- package/.git/shallow +0 -1
- package/.github/dependabot.yml +0 -10
- package/.github/workflows/ci.yml +0 -12
- package/.github/workflows/issues.yml +0 -13
- package/.github/workflows/publish.yml +0 -20
- package/.gitignore +0 -13
- package/.idea/.gitignore +0 -10
- package/.idea/aws.xml +0 -11
- package/.idea/codeStyles/Project.xml +0 -58
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/commons-js.iml +0 -14
- package/.idea/inspectionProfiles/Project_Default.xml +0 -7
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/prettier.xml +0 -6
- package/.idea/vcs.xml +0 -6
- package/.npmrc +0 -1
- package/.prettierignore +0 -7
- package/.prettierrc.cjs +0 -3
- package/LICENSE +0 -26
- package/README.md +0 -14
- package/coverage/base.css +0 -224
- package/coverage/bitsnbytes/b64.mts.html +0 -559
- package/coverage/bitsnbytes/index.html +0 -131
- package/coverage/bitsnbytes/index.mts.html +0 -88
- package/coverage/clover.xml +0 -1003
- package/coverage/coverage-final.json +0 -15
- package/coverage/errors/errors.mts.html +0 -898
- package/coverage/errors/index.html +0 -131
- package/coverage/errors/index.mts.html +0 -88
- package/coverage/favicon.png +0 -0
- package/coverage/http/http-method.mts.html +0 -112
- package/coverage/http/http-status-code.mts.html +0 -211
- package/coverage/http/index.html +0 -146
- package/coverage/http/index.mts.html +0 -91
- package/coverage/index.html +0 -191
- package/coverage/lang/index.html +0 -146
- package/coverage/lang/index.mts.html +0 -91
- package/coverage/lang/sleep.mts.html +0 -109
- package/coverage/lang/type-functions.mts.html +0 -124
- package/coverage/oauth/crypto-functions.mts.html +0 -217
- package/coverage/oauth/index.html +0 -131
- package/coverage/oauth/index.mts.html +0 -88
- package/coverage/prettify.css +0 -1
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/validator/index.html +0 -131
- package/coverage/validator/index.mts.html +0 -88
- package/coverage/validator/validators.mts.html +0 -1237
- package/dist/package.json +0 -72
- package/node_modules/@eslint/eslintrc/LICENSE +0 -19
- package/node_modules/@eslint/eslintrc/README.md +0 -115
- package/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs +0 -1104
- package/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs.map +0 -1
- package/node_modules/@eslint/eslintrc/dist/eslintrc.cjs +0 -4344
- package/node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map +0 -1
- package/node_modules/@eslint/eslintrc/package.json +0 -82
- package/node_modules/@eslint/eslintrc/universal.js +0 -9
- package/node_modules/@eslint/js/LICENSE +0 -19
- package/node_modules/@eslint/js/README.md +0 -57
- package/node_modules/@eslint/js/package.json +0 -31
- package/node_modules/@eslint/js/src/index.js +0 -17
- package/node_modules/@eslint-community/eslint-utils/LICENSE +0 -21
- package/node_modules/@eslint-community/eslint-utils/README.md +0 -37
- package/node_modules/@eslint-community/eslint-utils/index.js +0 -2068
- package/node_modules/@eslint-community/eslint-utils/index.js.map +0 -1
- package/node_modules/@eslint-community/eslint-utils/index.mjs +0 -2027
- package/node_modules/@eslint-community/eslint-utils/index.mjs.map +0 -1
- package/node_modules/@eslint-community/eslint-utils/package.json +0 -73
- package/node_modules/@eslint-community/regexpp/LICENSE +0 -21
- package/node_modules/@eslint-community/regexpp/README.md +0 -177
- package/node_modules/@eslint-community/regexpp/index.d.ts +0 -1065
- package/node_modules/@eslint-community/regexpp/index.js +0 -2747
- package/node_modules/@eslint-community/regexpp/index.js.map +0 -1
- package/node_modules/@eslint-community/regexpp/index.mjs +0 -2737
- package/node_modules/@eslint-community/regexpp/index.mjs.map +0 -1
- package/node_modules/@eslint-community/regexpp/package.json +0 -93
- package/node_modules/@types/node/LICENSE +0 -21
- package/node_modules/@types/node/README.md +0 -15
- package/node_modules/@types/node/package.json +0 -217
- package/node_modules/@typescript-eslint/eslint-plugin/LICENSE +0 -21
- package/node_modules/@typescript-eslint/eslint-plugin/README.md +0 -10
- package/node_modules/@typescript-eslint/eslint-plugin/dist/index.js +0 -23
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/README.md +0 -23
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/TEMPLATE.md +0 -26
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/adjacent-overload-signatures.md +0 -93
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/array-type.md +0 -103
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/await-thenable.md +0 -40
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-ts-comment.md +0 -148
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-tslint-comment.md +0 -39
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-types.md +0 -183
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/block-spacing.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/brace-style.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/camelcase.md +0 -10
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/class-literal-property-style.md +0 -114
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/comma-dangle.md +0 -22
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/comma-spacing.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-generic-constructors.md +0 -73
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-indexed-object-style.md +0 -80
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-assertions.md +0 -108
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-definitions.md +0 -82
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-exports.md +0 -100
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-imports.md +0 -105
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/default-param-last.md +0 -48
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/dot-notation.md +0 -77
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/explicit-function-return-type.md +0 -319
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/explicit-member-accessibility.md +0 -331
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/explicit-module-boundary-types.md +0 -250
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/func-call-spacing.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/indent.md +0 -20
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/init-declarations.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/key-spacing.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/keyword-spacing.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/lines-around-comment.md +0 -37
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/lines-between-class-members.md +0 -63
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/member-delimiter-style.md +0 -161
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/member-ordering.md +0 -1360
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/method-signature-style.md +0 -110
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/naming-convention.md +0 -706
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-array-constructor.md +0 -35
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-base-to-string.md +0 -88
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-confusing-non-null-assertion.md +0 -56
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-confusing-void-expression.md +0 -116
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-dupe-class-members.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-duplicate-enum-values.md +0 -50
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-duplicate-imports.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-duplicate-type-constituents.md +0 -61
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-dynamic-delete.md +0 -53
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-empty-function.md +0 -88
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-empty-interface.md +0 -70
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-explicit-any.md +0 -174
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extra-non-null-assertion.md +0 -52
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extra-parens.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extra-semi.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extraneous-class.md +0 -294
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-floating-promises.md +0 -106
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-for-in-array.md +0 -56
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-implicit-any-catch.md +0 -73
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-implied-eval.md +0 -101
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-import-type-side-effects.md +0 -75
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-inferrable-types.md +0 -103
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-invalid-this.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-invalid-void-type.md +0 -113
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-loop-func.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-loss-of-precision.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-magic-numbers.md +0 -131
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-meaningless-void-operator.md +0 -47
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-misused-new.md +0 -46
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-misused-promises.md +0 -245
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-mixed-enums.md +0 -88
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-namespace.md +0 -129
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-non-null-asserted-nullish-coalescing.md +0 -49
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-non-null-asserted-optional-chain.md +0 -35
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-non-null-assertion.md +0 -42
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-parameter-properties.md +0 -406
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-redeclare.md +0 -73
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-redundant-type-constituents.md +0 -78
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-require-imports.md +0 -37
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-restricted-imports.md +0 -63
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-shadow.md +0 -101
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-this-alias.md +0 -38
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-throw-literal.md +0 -111
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-type-alias.md +0 -602
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-boolean-literal-compare.md +0 -133
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-condition.md +0 -103
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-qualifier.md +0 -51
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-type-arguments.md +0 -73
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md +0 -77
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md +0 -55
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-argument.md +0 -83
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-assignment.md +0 -86
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-call.md +0 -58
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-declaration-merging.md +0 -54
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-enum-comparison.md +0 -75
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-member-access.md +0 -64
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-return.md +0 -103
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unused-expressions.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unused-vars.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-use-before-define.md +0 -97
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-useless-constructor.md +0 -21
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-useless-empty-export.md +0 -43
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-var-requires.md +0 -37
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/non-nullable-type-assertion-style.md +0 -41
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/object-curly-spacing.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/padding-line-between-statements.md +0 -35
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/parameter-properties.md +0 -485
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-as-const.md +0 -44
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-enum-initializers.md +0 -62
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-for-of.md +0 -46
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-function-type.md +0 -92
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-includes.md +0 -77
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-literal-enum-member.md +0 -101
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-namespace-keyword.md +0 -47
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-nullish-coalescing.md +0 -164
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-optional-chain.md +0 -71
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-readonly-parameter-types.md +0 -268
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-readonly.md +0 -87
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-reduce-type-parameter.md +0 -58
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-regexp-exec.md +0 -46
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-return-this-type.md +0 -87
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-string-starts-ends-with.md +0 -57
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-ts-expect-error.md +0 -69
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/promise-function-async.md +0 -59
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/quotes.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/require-array-sort-compare.md +0 -78
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/require-await.md +0 -24
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/restrict-plus-operands.md +0 -208
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/restrict-template-expressions.md +0 -117
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/return-await.md +0 -216
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/semi.md +0 -16
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/sort-type-constituents.md +0 -101
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/sort-type-union-intersection-members.md +0 -106
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/space-before-blocks.md +0 -42
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/space-before-function-paren.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/space-infix-ops.md +0 -16
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/strict-boolean-expressions.md +0 -183
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/switch-exhaustiveness-check.md +0 -106
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/triple-slash-reference.md +0 -61
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/type-annotation-spacing.md +0 -303
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/typedef.md +0 -320
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/unbound-method.md +0 -103
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/unified-signatures.md +0 -70
- package/node_modules/@typescript-eslint/eslint-plugin/index.d.ts +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/package.json +0 -87
- package/node_modules/@typescript-eslint/parser/LICENSE +0 -22
- package/node_modules/@typescript-eslint/parser/README.md +0 -10
- package/node_modules/@typescript-eslint/parser/dist/index.js +0 -17
- package/node_modules/@typescript-eslint/parser/package.json +0 -75
- package/node_modules/@typescript-eslint/scope-manager/LICENSE +0 -21
- package/node_modules/@typescript-eslint/scope-manager/README.md +0 -8
- package/node_modules/@typescript-eslint/scope-manager/dist/index.js +0 -31
- package/node_modules/@typescript-eslint/scope-manager/package.json +0 -67
- package/node_modules/@typescript-eslint/type-utils/LICENSE +0 -21
- package/node_modules/@typescript-eslint/type-utils/README.md +0 -12
- package/node_modules/@typescript-eslint/type-utils/dist/index.js +0 -36
- package/node_modules/@typescript-eslint/type-utils/package.json +0 -71
- package/node_modules/@typescript-eslint/types/LICENSE +0 -21
- package/node_modules/@typescript-eslint/types/README.md +0 -12
- package/node_modules/@typescript-eslint/types/dist/index.js +0 -24
- package/node_modules/@typescript-eslint/types/package.json +0 -84
- package/node_modules/@typescript-eslint/typescript-estree/LICENSE +0 -26
- package/node_modules/@typescript-eslint/typescript-estree/README.md +0 -10
- package/node_modules/@typescript-eslint/typescript-estree/dist/index.js +0 -38
- package/node_modules/@typescript-eslint/typescript-estree/package.json +0 -85
- package/node_modules/@typescript-eslint/utils/LICENSE +0 -21
- package/node_modules/@typescript-eslint/utils/README.md +0 -10
- package/node_modules/@typescript-eslint/utils/dist/index.js +0 -41
- package/node_modules/@typescript-eslint/utils/package.json +0 -70
- package/node_modules/@typescript-eslint/visitor-keys/LICENSE +0 -21
- package/node_modules/@typescript-eslint/visitor-keys/README.md +0 -10
- package/node_modules/@typescript-eslint/visitor-keys/dist/index.js +0 -8
- package/node_modules/@typescript-eslint/visitor-keys/package.json +0 -60
- package/node_modules/@vitest/coverage-v8/LICENSE +0 -21
- package/node_modules/@vitest/coverage-v8/dist/index.js +0 -54
- package/node_modules/@vitest/coverage-v8/package.json +0 -72
- package/pnpm-lock.yaml +0 -3277
- package/src/bitsnbytes/b64.mts +0 -158
- package/src/bitsnbytes/b64.test.mts +0 -78
- package/src/bitsnbytes/index.mts +0 -1
- package/src/errors/errors.mts +0 -271
- package/src/errors/errors.test.mts +0 -74
- package/src/errors/index.mts +0 -1
- package/src/http/http-method.mts +0 -9
- package/src/http/http-status-code.mts +0 -42
- package/src/http/index.mts +0 -2
- package/src/lang/index.mts +0 -2
- package/src/lang/sleep.mts +0 -8
- package/src/lang/type-functions.mts +0 -13
- package/src/oauth/crypto-functions.mts +0 -44
- package/src/oauth/crypto-functions.test.mts +0 -48
- package/src/oauth/index.mts +0 -1
- package/src/validator/index.mts +0 -1
- package/src/validator/validators.mts +0 -384
- package/src/validator/validators.test.mts +0 -245
- package/tsconfig.json +0 -18
- /package/{dist/bitsnbytes → bitsnbytes}/b64.d.mts +0 -0
- /package/{dist/bitsnbytes → bitsnbytes}/b64.d.mts.map +0 -0
- /package/{dist/bitsnbytes → bitsnbytes}/b64.mjs +0 -0
- /package/{dist/bitsnbytes → bitsnbytes}/b64.mjs.map +0 -0
- /package/{dist/bitsnbytes → bitsnbytes}/b64.test.d.mts +0 -0
- /package/{dist/bitsnbytes → bitsnbytes}/b64.test.d.mts.map +0 -0
- /package/{dist/bitsnbytes → bitsnbytes}/b64.test.mjs +0 -0
- /package/{dist/bitsnbytes → bitsnbytes}/b64.test.mjs.map +0 -0
- /package/{dist/bitsnbytes → bitsnbytes}/index.d.mts +0 -0
- /package/{dist/bitsnbytes → bitsnbytes}/index.d.mts.map +0 -0
- /package/{dist/bitsnbytes → bitsnbytes}/index.mjs +0 -0
- /package/{dist/bitsnbytes → bitsnbytes}/index.mjs.map +0 -0
- /package/{dist/errors → errors}/errors.d.mts +0 -0
- /package/{dist/errors → errors}/errors.d.mts.map +0 -0
- /package/{dist/errors → errors}/errors.mjs +0 -0
- /package/{dist/errors → errors}/errors.mjs.map +0 -0
- /package/{dist/errors → errors}/errors.test.d.mts +0 -0
- /package/{dist/errors → errors}/errors.test.d.mts.map +0 -0
- /package/{dist/errors → errors}/errors.test.mjs +0 -0
- /package/{dist/errors → errors}/errors.test.mjs.map +0 -0
- /package/{dist/errors → errors}/index.d.mts +0 -0
- /package/{dist/errors → errors}/index.d.mts.map +0 -0
- /package/{dist/errors → errors}/index.mjs +0 -0
- /package/{dist/errors → errors}/index.mjs.map +0 -0
- /package/{dist/http → http}/http-method.d.mts +0 -0
- /package/{dist/http → http}/http-method.d.mts.map +0 -0
- /package/{dist/http → http}/http-method.mjs +0 -0
- /package/{dist/http → http}/http-method.mjs.map +0 -0
- /package/{dist/http → http}/http-status-code.d.mts +0 -0
- /package/{dist/http → http}/http-status-code.d.mts.map +0 -0
- /package/{dist/http → http}/http-status-code.mjs +0 -0
- /package/{dist/http → http}/http-status-code.mjs.map +0 -0
- /package/{dist/http → http}/index.d.mts +0 -0
- /package/{dist/http → http}/index.d.mts.map +0 -0
- /package/{dist/http → http}/index.mjs +0 -0
- /package/{dist/http → http}/index.mjs.map +0 -0
- /package/{dist/lang → lang}/index.d.mts +0 -0
- /package/{dist/lang → lang}/index.d.mts.map +0 -0
- /package/{dist/lang → lang}/index.mjs +0 -0
- /package/{dist/lang → lang}/index.mjs.map +0 -0
- /package/{dist/lang → lang}/sleep.d.mts +0 -0
- /package/{dist/lang → lang}/sleep.d.mts.map +0 -0
- /package/{dist/lang → lang}/sleep.mjs +0 -0
- /package/{dist/lang → lang}/sleep.mjs.map +0 -0
- /package/{dist/lang → lang}/type-functions.d.mts +0 -0
- /package/{dist/lang → lang}/type-functions.d.mts.map +0 -0
- /package/{dist/lang → lang}/type-functions.mjs +0 -0
- /package/{dist/lang → lang}/type-functions.mjs.map +0 -0
- /package/{dist/oauth → oauth}/crypto-functions.d.mts +0 -0
- /package/{dist/oauth → oauth}/crypto-functions.d.mts.map +0 -0
- /package/{dist/oauth → oauth}/crypto-functions.mjs +0 -0
- /package/{dist/oauth → oauth}/crypto-functions.mjs.map +0 -0
- /package/{dist/oauth → oauth}/crypto-functions.test.d.mts +0 -0
- /package/{dist/oauth → oauth}/crypto-functions.test.d.mts.map +0 -0
- /package/{dist/oauth → oauth}/crypto-functions.test.mjs +0 -0
- /package/{dist/oauth → oauth}/crypto-functions.test.mjs.map +0 -0
- /package/{dist/oauth → oauth}/index.d.mts +0 -0
- /package/{dist/oauth → oauth}/index.d.mts.map +0 -0
- /package/{dist/oauth → oauth}/index.mjs +0 -0
- /package/{dist/oauth → oauth}/index.mjs.map +0 -0
- /package/{dist/validator → validator}/index.d.mts +0 -0
- /package/{dist/validator → validator}/index.d.mts.map +0 -0
- /package/{dist/validator → validator}/index.mjs +0 -0
- /package/{dist/validator → validator}/index.mjs.map +0 -0
- /package/{dist/validator → validator}/validators.d.mts +0 -0
- /package/{dist/validator → validator}/validators.d.mts.map +0 -0
- /package/{dist/validator → validator}/validators.mjs +0 -0
- /package/{dist/validator → validator}/validators.mjs.map +0 -0
- /package/{dist/validator → validator}/validators.test.d.mts +0 -0
- /package/{dist/validator → validator}/validators.test.d.mts.map +0 -0
- /package/{dist/validator → validator}/validators.test.mjs +0 -0
- /package/{dist/validator → validator}/validators.test.mjs.map +0 -0
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: 'Require any function or method that returns a Promise to be marked async.'
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
> 🛑 This file is source code, not the primary documentation location! 🛑
|
|
6
|
-
>
|
|
7
|
-
> See **https://typescript-eslint.io/rules/promise-function-async** for documentation.
|
|
8
|
-
|
|
9
|
-
Ensures that each function is only capable of:
|
|
10
|
-
|
|
11
|
-
- returning a rejected promise, or
|
|
12
|
-
- throwing an Error object.
|
|
13
|
-
|
|
14
|
-
In contrast, non-`async`, `Promise`-returning functions are technically capable of either.
|
|
15
|
-
Code that handles the results of those functions will often need to handle both cases, which can get complex.
|
|
16
|
-
This rule's practice removes a requirement for creating code to handle both cases.
|
|
17
|
-
|
|
18
|
-
> When functions return unions of `Promise` and non-`Promise` types implicitly, it is usually a mistake—this rule flags those cases. If it is intentional, make the return type explicitly to allow the rule to pass.
|
|
19
|
-
|
|
20
|
-
## Examples
|
|
21
|
-
|
|
22
|
-
Examples of code for this rule
|
|
23
|
-
|
|
24
|
-
<!--tabs-->
|
|
25
|
-
|
|
26
|
-
### ❌ Incorrect
|
|
27
|
-
|
|
28
|
-
```ts
|
|
29
|
-
const arrowFunctionReturnsPromise = () => Promise.resolve('value');
|
|
30
|
-
|
|
31
|
-
function functionReturnsPromise() {
|
|
32
|
-
return Promise.resolve('value');
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function functionReturnsUnionWithPromiseImplicitly(p: boolean) {
|
|
36
|
-
return p ? 'value' : Promise.resolve('value');
|
|
37
|
-
}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### ✅ Correct
|
|
41
|
-
|
|
42
|
-
```ts
|
|
43
|
-
const arrowFunctionReturnsPromise = async () => Promise.resolve('value');
|
|
44
|
-
|
|
45
|
-
async function functionReturnsPromise() {
|
|
46
|
-
return Promise.resolve('value');
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// An explicit return type that is not Promise means this function cannot be made async, so it is ignored by the rule
|
|
50
|
-
function functionReturnsUnionWithPromiseExplicitly(
|
|
51
|
-
p: boolean,
|
|
52
|
-
): string | Promise<string> {
|
|
53
|
-
return p ? 'value' : Promise.resolve('value');
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
async function functionReturnsUnionWithPromiseImplicitly(p: boolean) {
|
|
57
|
-
return p ? 'value' : Promise.resolve('value');
|
|
58
|
-
}
|
|
59
|
-
```
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: 'Enforce the consistent use of either backticks, double, or single quotes.'
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
> 🛑 This file is source code, not the primary documentation location! 🛑
|
|
6
|
-
>
|
|
7
|
-
> See **https://typescript-eslint.io/rules/quotes** for documentation.
|
|
8
|
-
|
|
9
|
-
## Examples
|
|
10
|
-
|
|
11
|
-
This rule extends the base [`eslint/quotes`](https://eslint.org/docs/rules/quotes) rule.
|
|
12
|
-
It adds support for TypeScript features which allow quoted names, but not backtick quoted names.
|
package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/require-array-sort-compare.md
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: 'Require `Array#sort` calls to always provide a `compareFunction`.'
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
> 🛑 This file is source code, not the primary documentation location! 🛑
|
|
6
|
-
>
|
|
7
|
-
> See **https://typescript-eslint.io/rules/require-array-sort-compare** for documentation.
|
|
8
|
-
|
|
9
|
-
When called without a compare function, `Array#sort()` converts all non-undefined array elements into strings and then compares said strings based off their UTF-16 code units [[ECMA specification](https://www.ecma-international.org/ecma-262/9.0/#sec-sortcompare)].
|
|
10
|
-
|
|
11
|
-
The result is that elements are sorted alphabetically, regardless of their type.
|
|
12
|
-
For example, when sorting numbers, this results in a "10 before 2" order:
|
|
13
|
-
|
|
14
|
-
```ts
|
|
15
|
-
[1, 2, 3, 10, 20, 30].sort(); //→ [1, 10, 2, 20, 3, 30]
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
This rule reports on any call to the `Array#sort()` method that doesn't provide a `compare` argument.
|
|
19
|
-
|
|
20
|
-
## Examples
|
|
21
|
-
|
|
22
|
-
This rule aims to ensure all calls of the native `Array#sort` method provide a `compareFunction`, while ignoring calls to user-defined `sort` methods.
|
|
23
|
-
|
|
24
|
-
<!--tabs-->
|
|
25
|
-
|
|
26
|
-
### ❌ Incorrect
|
|
27
|
-
|
|
28
|
-
```ts
|
|
29
|
-
const array: any[];
|
|
30
|
-
const stringArray: string[];
|
|
31
|
-
|
|
32
|
-
array.sort();
|
|
33
|
-
|
|
34
|
-
// String arrays should be sorted using `String#localeCompare`.
|
|
35
|
-
stringArray.sort();
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### ✅ Correct
|
|
39
|
-
|
|
40
|
-
```ts
|
|
41
|
-
const array: any[];
|
|
42
|
-
const userDefinedType: { sort(): void };
|
|
43
|
-
|
|
44
|
-
array.sort((a, b) => a - b);
|
|
45
|
-
array.sort((a, b) => a.localeCompare(b));
|
|
46
|
-
|
|
47
|
-
userDefinedType.sort();
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
## Options
|
|
51
|
-
|
|
52
|
-
### `ignoreStringArrays`
|
|
53
|
-
|
|
54
|
-
Examples of code for this rule with `{ ignoreStringArrays: true }`:
|
|
55
|
-
|
|
56
|
-
<!--tabs-->
|
|
57
|
-
|
|
58
|
-
#### ❌ Incorrect
|
|
59
|
-
|
|
60
|
-
```ts
|
|
61
|
-
const one = 1;
|
|
62
|
-
const two = 2;
|
|
63
|
-
const three = 3;
|
|
64
|
-
[one, two, three].sort();
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
#### ✅ Correct
|
|
68
|
-
|
|
69
|
-
```ts
|
|
70
|
-
const one = '1';
|
|
71
|
-
const two = '2';
|
|
72
|
-
const three = '3';
|
|
73
|
-
[one, two, three].sort();
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
## When Not To Use It
|
|
77
|
-
|
|
78
|
-
If you understand the language specification enough, and/or only ever sort arrays in a string-like manner, you can turn this rule off safely.
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: 'Disallow async functions which have no `await` expression.'
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
> 🛑 This file is source code, not the primary documentation location! 🛑
|
|
6
|
-
>
|
|
7
|
-
> See **https://typescript-eslint.io/rules/require-await** for documentation.
|
|
8
|
-
|
|
9
|
-
## Examples
|
|
10
|
-
|
|
11
|
-
This rule extends the base [`eslint/require-await`](https://eslint.org/docs/rules/require-await) rule.
|
|
12
|
-
It uses type information to add support for `async` functions that return a `Promise`.
|
|
13
|
-
|
|
14
|
-
Examples of **correct** code for this rule:
|
|
15
|
-
|
|
16
|
-
```ts
|
|
17
|
-
async function returnsPromise1() {
|
|
18
|
-
return Promise.resolve(1);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const returnsPromise2 = () => returnsPromise1();
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## How to Use
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: 'Require both operands of addition to be the same type and be `bigint`, `number`, or `string`.'
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
> 🛑 This file is source code, not the primary documentation location! 🛑
|
|
6
|
-
>
|
|
7
|
-
> See **https://typescript-eslint.io/rules/restrict-plus-operands** for documentation.
|
|
8
|
-
|
|
9
|
-
TypeScript allows `+` adding together two values of any type(s).
|
|
10
|
-
However, adding values that are not the same type and/or are not the same primitive type is often a sign of programmer error.
|
|
11
|
-
|
|
12
|
-
This rule reports when a `+` operation combines two values of different types, or a type that is not `bigint`, `number`, or `string`.
|
|
13
|
-
|
|
14
|
-
## Examples
|
|
15
|
-
|
|
16
|
-
<!--tabs-->
|
|
17
|
-
|
|
18
|
-
### ❌ Incorrect
|
|
19
|
-
|
|
20
|
-
```ts
|
|
21
|
-
let foo = '5.5' + 5;
|
|
22
|
-
let foo = 1n + 1;
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
### ✅ Correct
|
|
26
|
-
|
|
27
|
-
```ts
|
|
28
|
-
let foo = parseInt('5.5', 10) + 10;
|
|
29
|
-
let foo = 1n + 1n;
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Options
|
|
33
|
-
|
|
34
|
-
:::caution
|
|
35
|
-
We generally recommend against using these options, as they limit which varieties of incorrect `+` usage can be checked.
|
|
36
|
-
This in turn severely limits the validation that the rule can do to ensure that resulting strings and numbers are correct.
|
|
37
|
-
|
|
38
|
-
Safer alternatives to using the `allow*` options include:
|
|
39
|
-
|
|
40
|
-
- Using variadic forms of logging APIs to avoid needing to `+` values.
|
|
41
|
-
```ts
|
|
42
|
-
// Remove this line
|
|
43
|
-
console.log('The result is ' + true);
|
|
44
|
-
// Add this line
|
|
45
|
-
console.log('The result is', true);
|
|
46
|
-
```
|
|
47
|
-
- Using `.toFixed()` to coerce numbers to well-formed string representations:
|
|
48
|
-
```ts
|
|
49
|
-
const number = 1.123456789;
|
|
50
|
-
const result = 'The number is ' + number.toFixed(2);
|
|
51
|
-
// result === 'The number is 1.12'
|
|
52
|
-
```
|
|
53
|
-
- Calling `.toString()` on other types to mark explicit and intentional string coercion:
|
|
54
|
-
```ts
|
|
55
|
-
const arg = '11';
|
|
56
|
-
const regex = /[0-9]/;
|
|
57
|
-
const result =
|
|
58
|
-
'The result of ' +
|
|
59
|
-
regex.toString() +
|
|
60
|
-
'.test("' +
|
|
61
|
-
arg +
|
|
62
|
-
'") is ' +
|
|
63
|
-
regex.test(arg).toString();
|
|
64
|
-
// result === 'The result of /[0-9]/.test("11") is true'
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
:::
|
|
68
|
-
|
|
69
|
-
### `allowAny`
|
|
70
|
-
|
|
71
|
-
Examples of code for this rule with `{ allowAny: true }`:
|
|
72
|
-
|
|
73
|
-
<!--tabs-->
|
|
74
|
-
|
|
75
|
-
#### ❌ Incorrect
|
|
76
|
-
|
|
77
|
-
```ts
|
|
78
|
-
let fn = (a: number, b: []) => a + b;
|
|
79
|
-
let fn = (a: string, b: []) => a + b;
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
#### ✅ Correct
|
|
83
|
-
|
|
84
|
-
```ts
|
|
85
|
-
let fn = (a: number, b: any) => a + b;
|
|
86
|
-
let fn = (a: string, b: any) => a + b;
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
### `allowBoolean`
|
|
90
|
-
|
|
91
|
-
Examples of code for this rule with `{ allowBoolean: true }`:
|
|
92
|
-
|
|
93
|
-
<!--tabs-->
|
|
94
|
-
|
|
95
|
-
#### ❌ Incorrect
|
|
96
|
-
|
|
97
|
-
```ts
|
|
98
|
-
let fn = (a: number, b: unknown) => a + b;
|
|
99
|
-
let fn = (a: string, b: unknown) => a + b;
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
#### ✅ Correct
|
|
103
|
-
|
|
104
|
-
```ts
|
|
105
|
-
let fn = (a: number, b: boolean) => a + b;
|
|
106
|
-
let fn = (a: string, b: boolean) => a + b;
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### `allowNullish`
|
|
110
|
-
|
|
111
|
-
Examples of code for this rule with `{ allowNullish: true }`:
|
|
112
|
-
|
|
113
|
-
<!--tabs-->
|
|
114
|
-
|
|
115
|
-
#### ❌ Incorrect
|
|
116
|
-
|
|
117
|
-
```ts
|
|
118
|
-
let fn = (a: number, b: unknown) => a + b;
|
|
119
|
-
let fn = (a: number, b: never) => a + b;
|
|
120
|
-
let fn = (a: string, b: unknown) => a + b;
|
|
121
|
-
let fn = (a: string, b: never) => a + b;
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
#### ✅ Correct
|
|
125
|
-
|
|
126
|
-
```ts
|
|
127
|
-
let fn = (a: number, b: undefined) => a + b;
|
|
128
|
-
let fn = (a: number, b: null) => a + b;
|
|
129
|
-
let fn = (a: string, b: undefined) => a + b;
|
|
130
|
-
let fn = (a: string, b: null) => a + b;
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
### `allowNumberAndString`
|
|
134
|
-
|
|
135
|
-
Examples of code for this rule with `{ allowNumberAndString: true }`:
|
|
136
|
-
|
|
137
|
-
<!--tabs-->
|
|
138
|
-
|
|
139
|
-
#### ❌ Incorrect
|
|
140
|
-
|
|
141
|
-
```ts
|
|
142
|
-
let fn = (a: number, b: unknown) => a + b;
|
|
143
|
-
let fn = (a: number, b: never) => a + b;
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
#### ✅ Correct
|
|
147
|
-
|
|
148
|
-
```ts
|
|
149
|
-
let fn = (a: number, b: string) => a + b;
|
|
150
|
-
let fn = (a: number, b: number | string) => a + b;
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
### `allowRegExp`
|
|
154
|
-
|
|
155
|
-
Examples of code for this rule with `{ allowRegExp: true }`:
|
|
156
|
-
|
|
157
|
-
<!--tabs-->
|
|
158
|
-
|
|
159
|
-
#### ❌ Incorrect
|
|
160
|
-
|
|
161
|
-
```ts
|
|
162
|
-
let fn = (a: number, b: RegExp) => a + b;
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
#### ✅ Correct
|
|
166
|
-
|
|
167
|
-
```ts
|
|
168
|
-
let fn = (a: string, b: RegExp) => a + b;
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
### `checkCompoundAssignments`
|
|
172
|
-
|
|
173
|
-
Examples of code for this rule with `{ checkCompoundAssignments: true }`:
|
|
174
|
-
|
|
175
|
-
<!--tabs-->
|
|
176
|
-
|
|
177
|
-
#### ❌ Incorrect
|
|
178
|
-
|
|
179
|
-
```ts
|
|
180
|
-
let foo: string | undefined;
|
|
181
|
-
foo += 'some data';
|
|
182
|
-
|
|
183
|
-
let bar: string = '';
|
|
184
|
-
bar += 0;
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
#### ✅ Correct
|
|
188
|
-
|
|
189
|
-
```ts
|
|
190
|
-
let foo: number = 0;
|
|
191
|
-
foo += 1;
|
|
192
|
-
|
|
193
|
-
let bar = '';
|
|
194
|
-
bar += 'test';
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
## When Not To Use It
|
|
198
|
-
|
|
199
|
-
If you don't mind `"[object Object]"` in your strings, then you will not need this rule.
|
|
200
|
-
|
|
201
|
-
## Related To
|
|
202
|
-
|
|
203
|
-
- [`no-base-to-string`](./no-base-to-string.md)
|
|
204
|
-
- [`restrict-template-expressions`](./restrict-template-expressions.md)
|
|
205
|
-
|
|
206
|
-
## Further Reading
|
|
207
|
-
|
|
208
|
-
- [`Object.prototype.toString()` MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString)
|
package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/restrict-template-expressions.md
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: 'Enforce template literal expressions to be of `string` type.'
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
> 🛑 This file is source code, not the primary documentation location! 🛑
|
|
6
|
-
>
|
|
7
|
-
> See **https://typescript-eslint.io/rules/restrict-template-expressions** for documentation.
|
|
8
|
-
|
|
9
|
-
JavaScript automatically [converts an object to a string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String#string_coercion) in a string context, such as when concatenating it with a string using `+` or embedding it in a template literal using `${}`.
|
|
10
|
-
The default `toString()` method of objects returns `"[object Object]"`, which is often not what was intended.
|
|
11
|
-
This rule reports on values used in a template literal string that aren't strings, numbers, or BigInts, optionally allowing other data types that provide useful stringification results.
|
|
12
|
-
|
|
13
|
-
:::note
|
|
14
|
-
|
|
15
|
-
This rule intentionally does not allow objects with a custom `toString()` method to be used in template literals, because the stringification result may not be user-friendly.
|
|
16
|
-
|
|
17
|
-
For example, arrays have a custom [`toString()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString) method, which only calls `join()` internally, which joins the array elements with commas. This means that (1) array elements are not necessarily stringified to useful results (2) the commas don't have spaces after them, making the result not user-friendly. The best way to format arrays is to use [`Intl.ListFormat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat), which even supports adding the "and" conjunction where necessary.
|
|
18
|
-
You must explicitly call `object.toString()` if you want to use this object in a template literal.
|
|
19
|
-
The [`no-base-to-string`](./no-base-to-string.md) rule can be used to guard this case against producing `"[object Object]"` by accident.
|
|
20
|
-
|
|
21
|
-
:::
|
|
22
|
-
|
|
23
|
-
## Examples
|
|
24
|
-
|
|
25
|
-
<!--tabs-->
|
|
26
|
-
|
|
27
|
-
### ❌ Incorrect
|
|
28
|
-
|
|
29
|
-
```ts
|
|
30
|
-
const arg1 = [1, 2];
|
|
31
|
-
const msg1 = `arg1 = ${arg1}`;
|
|
32
|
-
|
|
33
|
-
const arg2 = { name: 'Foo' };
|
|
34
|
-
const msg2 = `arg2 = ${arg2 || null}`;
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### ✅ Correct
|
|
38
|
-
|
|
39
|
-
```ts
|
|
40
|
-
const arg = 'foo';
|
|
41
|
-
const msg1 = `arg = ${arg}`;
|
|
42
|
-
const msg2 = `arg = ${arg || 'default'}`;
|
|
43
|
-
|
|
44
|
-
const stringWithKindProp: string & { _kind?: 'MyString' } = 'foo';
|
|
45
|
-
const msg3 = `stringWithKindProp = ${stringWithKindProp}`;
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## Options
|
|
49
|
-
|
|
50
|
-
### `allowNumber`
|
|
51
|
-
|
|
52
|
-
Examples of additional **correct** code for this rule with `{ allowNumber: true }`:
|
|
53
|
-
|
|
54
|
-
```ts
|
|
55
|
-
const arg = 123;
|
|
56
|
-
const msg1 = `arg = ${arg}`;
|
|
57
|
-
const msg2 = `arg = ${arg || 'zero'}`;
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
This option controls both numbers and BigInts.
|
|
61
|
-
|
|
62
|
-
### `allowBoolean`
|
|
63
|
-
|
|
64
|
-
Examples of additional **correct** code for this rule with `{ allowBoolean: true }`:
|
|
65
|
-
|
|
66
|
-
```ts
|
|
67
|
-
const arg = true;
|
|
68
|
-
const msg1 = `arg = ${arg}`;
|
|
69
|
-
const msg2 = `arg = ${arg || 'not truthy'}`;
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### `allowAny`
|
|
73
|
-
|
|
74
|
-
Examples of additional **correct** code for this rule with `{ allowAny: true }`:
|
|
75
|
-
|
|
76
|
-
```ts
|
|
77
|
-
const user = JSON.parse('{ "name": "foo" }');
|
|
78
|
-
const msg1 = `arg = ${user.name}`;
|
|
79
|
-
const msg2 = `arg = ${user.name || 'the user with no name'}`;
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
### `allowNullish`
|
|
83
|
-
|
|
84
|
-
Examples of additional **correct** code for this rule with `{ allowNullish: true }`:
|
|
85
|
-
|
|
86
|
-
```ts
|
|
87
|
-
const arg = condition ? 'ok' : null;
|
|
88
|
-
const msg1 = `arg = ${arg}`;
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### `allowRegExp`
|
|
92
|
-
|
|
93
|
-
Examples of additional **correct** code for this rule with `{ allowRegExp: true }`:
|
|
94
|
-
|
|
95
|
-
```ts
|
|
96
|
-
const arg = new RegExp('foo');
|
|
97
|
-
const msg1 = `arg = ${arg}`;
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
```ts
|
|
101
|
-
const arg = /foo/;
|
|
102
|
-
const msg1 = `arg = ${arg}`;
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
### `allowNever`
|
|
106
|
-
|
|
107
|
-
Examples of additional **correct** code for this rule with `{ allowNever: true }`:
|
|
108
|
-
|
|
109
|
-
```ts
|
|
110
|
-
const arg = 'something';
|
|
111
|
-
const msg1 = typeof arg === 'string' ? arg : `arg = ${arg}`;
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
## Related To
|
|
115
|
-
|
|
116
|
-
- [`no-base-to-string`](./no-base-to-string.md)
|
|
117
|
-
- [`restrict-plus-operands`](./restrict-plus-operands.md)
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: 'Enforce consistent returning of awaited values.'
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
> 🛑 This file is source code, not the primary documentation location! 🛑
|
|
6
|
-
>
|
|
7
|
-
> See **https://typescript-eslint.io/rules/return-await** for documentation.
|
|
8
|
-
|
|
9
|
-
Returning an awaited promise can make sense for better stack trace information as well as for consistent error handling (returned promises will not be caught in an async function try/catch).
|
|
10
|
-
|
|
11
|
-
## Examples
|
|
12
|
-
|
|
13
|
-
This rule builds on top of the [`eslint/no-return-await`](https://eslint.org/docs/rules/no-return-await) rule.
|
|
14
|
-
It expands upon the base rule to add support for optionally requiring `return await` in certain cases.
|
|
15
|
-
|
|
16
|
-
## Options
|
|
17
|
-
|
|
18
|
-
```ts
|
|
19
|
-
type Options = 'in-try-catch' | 'always' | 'never';
|
|
20
|
-
|
|
21
|
-
const defaultOptions: Options = 'in-try-catch';
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### `in-try-catch`
|
|
25
|
-
|
|
26
|
-
Requires that a returned promise must be `await`ed in `try-catch-finally` blocks, and disallows it elsewhere.
|
|
27
|
-
Specifically:
|
|
28
|
-
|
|
29
|
-
- if you `return` a promise within a `try`, then it must be `await`ed.
|
|
30
|
-
- if you `return` a promise within a `catch`, and there **_is no_** `finally`, then it **_must not_** be `await`ed.
|
|
31
|
-
- if you `return` a promise within a `catch`, and there **_is a_** `finally`, then it **_must_** be `await`ed.
|
|
32
|
-
- if you `return` a promise within a `finally`, then it **_must not_** be `await`ed.
|
|
33
|
-
|
|
34
|
-
Examples of code with `in-try-catch`:
|
|
35
|
-
|
|
36
|
-
<!--tabs-->
|
|
37
|
-
|
|
38
|
-
#### ❌ Incorrect
|
|
39
|
-
|
|
40
|
-
```ts
|
|
41
|
-
async function invalidInTryCatch1() {
|
|
42
|
-
try {
|
|
43
|
-
return Promise.resolve('try');
|
|
44
|
-
} catch (e) {}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
async function invalidInTryCatch2() {
|
|
48
|
-
try {
|
|
49
|
-
throw new Error('error');
|
|
50
|
-
} catch (e) {
|
|
51
|
-
return await Promise.resolve('catch');
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
async function invalidInTryCatch3() {
|
|
56
|
-
try {
|
|
57
|
-
throw new Error('error');
|
|
58
|
-
} catch (e) {
|
|
59
|
-
return Promise.resolve('catch');
|
|
60
|
-
} finally {
|
|
61
|
-
console.log('cleanup');
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
async function invalidInTryCatch4() {
|
|
66
|
-
try {
|
|
67
|
-
throw new Error('error');
|
|
68
|
-
} catch (e) {
|
|
69
|
-
throw new Error('error2');
|
|
70
|
-
} finally {
|
|
71
|
-
return await Promise.resolve('finally');
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
async function invalidInTryCatch5() {
|
|
76
|
-
return await Promise.resolve('try');
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
async function invalidInTryCatch6() {
|
|
80
|
-
return await 'value';
|
|
81
|
-
}
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
#### ✅ Correct
|
|
85
|
-
|
|
86
|
-
```ts
|
|
87
|
-
async function validInTryCatch1() {
|
|
88
|
-
try {
|
|
89
|
-
return await Promise.resolve('try');
|
|
90
|
-
} catch (e) {}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
async function validInTryCatch2() {
|
|
94
|
-
try {
|
|
95
|
-
throw new Error('error');
|
|
96
|
-
} catch (e) {
|
|
97
|
-
return Promise.resolve('catch');
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
async function validInTryCatch3() {
|
|
102
|
-
try {
|
|
103
|
-
throw new Error('error');
|
|
104
|
-
} catch (e) {
|
|
105
|
-
return await Promise.resolve('catch');
|
|
106
|
-
} finally {
|
|
107
|
-
console.log('cleanup');
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
async function validInTryCatch4() {
|
|
112
|
-
try {
|
|
113
|
-
throw new Error('error');
|
|
114
|
-
} catch (e) {
|
|
115
|
-
throw new Error('error2');
|
|
116
|
-
} finally {
|
|
117
|
-
return Promise.resolve('finally');
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
async function validInTryCatch5() {
|
|
122
|
-
return Promise.resolve('try');
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
async function validInTryCatch6() {
|
|
126
|
-
return 'value';
|
|
127
|
-
}
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
### `always`
|
|
131
|
-
|
|
132
|
-
Requires that all returned promises are `await`ed.
|
|
133
|
-
|
|
134
|
-
Examples of code with `always`:
|
|
135
|
-
|
|
136
|
-
<!--tabs-->
|
|
137
|
-
|
|
138
|
-
#### ❌ Incorrect
|
|
139
|
-
|
|
140
|
-
```ts
|
|
141
|
-
async function invalidAlways1() {
|
|
142
|
-
try {
|
|
143
|
-
return Promise.resolve('try');
|
|
144
|
-
} catch (e) {}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
async function invalidAlways2() {
|
|
148
|
-
return Promise.resolve('try');
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
async function invalidAlways3() {
|
|
152
|
-
return await 'value';
|
|
153
|
-
}
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
#### ✅ Correct
|
|
157
|
-
|
|
158
|
-
```ts
|
|
159
|
-
async function validAlways1() {
|
|
160
|
-
try {
|
|
161
|
-
return await Promise.resolve('try');
|
|
162
|
-
} catch (e) {}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
async function validAlways2() {
|
|
166
|
-
return await Promise.resolve('try');
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
async function validAlways3() {
|
|
170
|
-
return 'value';
|
|
171
|
-
}
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
### `never`
|
|
175
|
-
|
|
176
|
-
Disallows all `await`ing any returned promises.
|
|
177
|
-
|
|
178
|
-
Examples of code with `never`:
|
|
179
|
-
|
|
180
|
-
<!--tabs-->
|
|
181
|
-
|
|
182
|
-
#### ❌ Incorrect
|
|
183
|
-
|
|
184
|
-
```ts
|
|
185
|
-
async function invalidNever1() {
|
|
186
|
-
try {
|
|
187
|
-
return await Promise.resolve('try');
|
|
188
|
-
} catch (e) {}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
async function invalidNever2() {
|
|
192
|
-
return await Promise.resolve('try');
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
async function invalidNever3() {
|
|
196
|
-
return await 'value';
|
|
197
|
-
}
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
#### ✅ Correct
|
|
201
|
-
|
|
202
|
-
```ts
|
|
203
|
-
async function validNever1() {
|
|
204
|
-
try {
|
|
205
|
-
return Promise.resolve('try');
|
|
206
|
-
} catch (e) {}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
async function validNever2() {
|
|
210
|
-
return Promise.resolve('try');
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
async function validNever3() {
|
|
214
|
-
return 'value';
|
|
215
|
-
}
|
|
216
|
-
```
|