@nr1e/commons 0.1.0-alpha.1 → 0.1.1-alpha.0
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/.editorconfig +19 -0
- package/.eslintignore +3 -0
- package/.eslintrc.json +4 -0
- package/.git/COMMIT_EDITMSG +5 -0
- package/.git/FETCH_HEAD +1 -0
- package/.git/HEAD +1 -0
- package/.git/config +18 -0
- package/.git/config.worktree +5 -0
- package/.git/description +1 -0
- package/.git/hooks/applypatch-msg.sample +15 -0
- package/.git/hooks/commit-msg.sample +24 -0
- package/.git/hooks/fsmonitor-watchman.sample +174 -0
- package/.git/hooks/post-update.sample +8 -0
- package/.git/hooks/pre-applypatch.sample +14 -0
- package/.git/hooks/pre-commit.sample +49 -0
- package/.git/hooks/pre-merge-commit.sample +13 -0
- package/.git/hooks/pre-push.sample +53 -0
- package/.git/hooks/pre-rebase.sample +169 -0
- package/.git/hooks/pre-receive.sample +24 -0
- package/.git/hooks/prepare-commit-msg.sample +42 -0
- package/.git/hooks/push-to-checkout.sample +78 -0
- package/.git/hooks/sendemail-validate.sample +77 -0
- package/.git/hooks/update.sample +128 -0
- package/.git/index +0 -0
- package/.git/info/exclude +6 -0
- package/.git/logs/HEAD +2 -0
- package/.git/logs/refs/heads/develop +2 -0
- package/.git/logs/refs/remotes/origin/develop +2 -0
- 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 +3 -0
- package/.git/objects/12/069a5aa45479564e00749f730582627a276a55 +3 -0
- package/.git/objects/14/5ab9cf82c40696a07ab42f117ba199acb2a50b +4 -0
- package/.git/objects/17/7b0dc4bf884f8ae0403b4aad053e76baafd632 +2 -0
- package/.git/objects/1d/a517ce3527df45a4f28e52ff2c0d9d1c8179f6 +0 -0
- package/.git/objects/26/d9a4912af870ce319f5cb5102651d49baac4ab +1 -0
- package/.git/objects/27/50076ed23b5211a52ef834f40f183ddecb917a +0 -0
- package/.git/objects/2a/96e4bb57fa4bd69c719dca224b17b569e94e82 +2 -0
- 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 +2 -0
- package/.git/objects/64/3fa02661c3a1b54205729a75d2fb5f013833af +0 -0
- package/.git/objects/6c/59086d862516d2fffa5da2035e5003100fb5c7 +0 -0
- package/.git/objects/6c/b74f90a0c799eea1c54a04d8d6a8a9e9691cca +2 -0
- 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 +1 -0
- package/.git/objects/87/f31d3df8e7edbf96e45d80126f878b8e0c243f +0 -0
- package/.git/objects/8d/d819967bdc8457f04c1b5498bce89380d6552b +7 -0
- package/.git/objects/92/608c4e069a4301d466d8d18daecbe7abc9500e +0 -0
- package/.git/objects/94/a25f7f4cb416c083d265558da75d457237d671 +0 -0
- package/.git/objects/9c/69411050eac81b5dce09314516a30b38c41a20 +3 -0
- 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 +1 -0
- package/.git/refs/remotes/origin/develop +1 -0
- package/.git/shallow +1 -0
- package/.github/dependabot.yml +10 -0
- package/.github/workflows/ci.yml +12 -0
- package/.github/workflows/issues.yml +13 -0
- package/.github/workflows/publish.yml +20 -0
- package/.gitignore +13 -0
- package/.idea/.gitignore +10 -0
- package/.idea/aws.xml +11 -0
- package/.idea/codeStyles/Project.xml +58 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/commons-js.iml +14 -0
- package/.idea/inspectionProfiles/Project_Default.xml +7 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/prettier.xml +6 -0
- package/.idea/vcs.xml +6 -0
- package/.npmrc +1 -0
- package/.prettierignore +7 -0
- package/.prettierrc.cjs +3 -0
- package/LICENSE +26 -0
- package/README.md +14 -0
- package/coverage/base.css +224 -0
- package/coverage/bitsnbytes/b64.mts.html +559 -0
- package/coverage/bitsnbytes/index.html +131 -0
- package/coverage/bitsnbytes/index.mts.html +88 -0
- package/coverage/clover.xml +1003 -0
- package/coverage/coverage-final.json +15 -0
- package/coverage/errors/errors.mts.html +898 -0
- package/coverage/errors/index.html +131 -0
- package/coverage/errors/index.mts.html +88 -0
- package/coverage/favicon.png +0 -0
- package/coverage/http/http-method.mts.html +112 -0
- package/coverage/http/http-status-code.mts.html +211 -0
- package/coverage/http/index.html +146 -0
- package/coverage/http/index.mts.html +91 -0
- package/coverage/index.html +191 -0
- package/coverage/lang/index.html +146 -0
- package/coverage/lang/index.mts.html +91 -0
- package/coverage/lang/sleep.mts.html +109 -0
- package/coverage/lang/type-functions.mts.html +124 -0
- package/coverage/oauth/crypto-functions.mts.html +217 -0
- package/coverage/oauth/index.html +131 -0
- package/coverage/oauth/index.mts.html +88 -0
- package/coverage/prettify.css +1 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/validator/index.html +131 -0
- package/coverage/validator/index.mts.html +88 -0
- package/coverage/validator/validators.mts.html +1237 -0
- package/dist/package.json +72 -0
- package/node_modules/@eslint/eslintrc/LICENSE +19 -0
- package/node_modules/@eslint/eslintrc/README.md +115 -0
- package/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs +1104 -0
- package/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs.map +1 -0
- package/node_modules/@eslint/eslintrc/dist/eslintrc.cjs +4344 -0
- package/node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map +1 -0
- package/node_modules/@eslint/eslintrc/package.json +82 -0
- package/node_modules/@eslint/eslintrc/universal.js +9 -0
- package/node_modules/@eslint/js/LICENSE +19 -0
- package/node_modules/@eslint/js/README.md +57 -0
- package/node_modules/@eslint/js/package.json +31 -0
- package/node_modules/@eslint/js/src/index.js +17 -0
- package/node_modules/@eslint-community/eslint-utils/LICENSE +21 -0
- package/node_modules/@eslint-community/eslint-utils/README.md +37 -0
- package/node_modules/@eslint-community/eslint-utils/index.js +2068 -0
- package/node_modules/@eslint-community/eslint-utils/index.js.map +1 -0
- package/node_modules/@eslint-community/eslint-utils/index.mjs +2027 -0
- package/node_modules/@eslint-community/eslint-utils/index.mjs.map +1 -0
- package/node_modules/@eslint-community/eslint-utils/package.json +73 -0
- package/node_modules/@eslint-community/regexpp/LICENSE +21 -0
- package/node_modules/@eslint-community/regexpp/README.md +177 -0
- package/node_modules/@eslint-community/regexpp/index.d.ts +1065 -0
- package/node_modules/@eslint-community/regexpp/index.js +2747 -0
- package/node_modules/@eslint-community/regexpp/index.js.map +1 -0
- package/node_modules/@eslint-community/regexpp/index.mjs +2737 -0
- package/node_modules/@eslint-community/regexpp/index.mjs.map +1 -0
- package/node_modules/@eslint-community/regexpp/package.json +93 -0
- package/node_modules/@types/node/LICENSE +21 -0
- package/node_modules/@types/node/README.md +15 -0
- package/node_modules/@types/node/package.json +217 -0
- package/node_modules/@typescript-eslint/eslint-plugin/LICENSE +21 -0
- package/node_modules/@typescript-eslint/eslint-plugin/README.md +10 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/index.js +23 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/README.md +23 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/TEMPLATE.md +26 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/adjacent-overload-signatures.md +93 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/array-type.md +103 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/await-thenable.md +40 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-ts-comment.md +148 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-tslint-comment.md +39 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-types.md +183 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/block-spacing.md +12 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/brace-style.md +12 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/camelcase.md +10 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/class-literal-property-style.md +114 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/comma-dangle.md +22 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/comma-spacing.md +12 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-generic-constructors.md +73 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-indexed-object-style.md +80 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-assertions.md +108 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-definitions.md +82 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-exports.md +100 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-imports.md +105 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/default-param-last.md +48 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/dot-notation.md +77 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/explicit-function-return-type.md +319 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/explicit-member-accessibility.md +331 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/explicit-module-boundary-types.md +250 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/func-call-spacing.md +12 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/indent.md +20 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/init-declarations.md +12 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/key-spacing.md +12 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/keyword-spacing.md +12 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/lines-around-comment.md +37 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/lines-between-class-members.md +63 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/member-delimiter-style.md +161 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/member-ordering.md +1360 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/method-signature-style.md +110 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/naming-convention.md +706 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-array-constructor.md +35 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-base-to-string.md +88 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-confusing-non-null-assertion.md +56 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-confusing-void-expression.md +116 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-dupe-class-members.md +12 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-duplicate-enum-values.md +50 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-duplicate-imports.md +12 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-duplicate-type-constituents.md +61 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-dynamic-delete.md +53 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-empty-function.md +88 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-empty-interface.md +70 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-explicit-any.md +174 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extra-non-null-assertion.md +52 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extra-parens.md +12 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extra-semi.md +12 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extraneous-class.md +294 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-floating-promises.md +106 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-for-in-array.md +56 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-implicit-any-catch.md +73 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-implied-eval.md +101 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-import-type-side-effects.md +75 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-inferrable-types.md +103 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-invalid-this.md +12 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-invalid-void-type.md +113 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-loop-func.md +12 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-loss-of-precision.md +12 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-magic-numbers.md +131 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-meaningless-void-operator.md +47 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-misused-new.md +46 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-misused-promises.md +245 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-mixed-enums.md +88 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-namespace.md +129 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-non-null-asserted-nullish-coalescing.md +49 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-non-null-asserted-optional-chain.md +35 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-non-null-assertion.md +42 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-parameter-properties.md +406 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-redeclare.md +73 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-redundant-type-constituents.md +78 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-require-imports.md +37 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-restricted-imports.md +63 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-shadow.md +101 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-this-alias.md +38 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-throw-literal.md +111 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-type-alias.md +602 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-boolean-literal-compare.md +133 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-condition.md +103 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-qualifier.md +51 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-type-arguments.md +73 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md +77 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md +55 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-argument.md +83 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-assignment.md +86 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-call.md +58 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-declaration-merging.md +54 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-enum-comparison.md +75 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-member-access.md +64 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-return.md +103 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unused-expressions.md +12 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unused-vars.md +12 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-use-before-define.md +97 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-useless-constructor.md +21 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-useless-empty-export.md +43 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-var-requires.md +37 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/non-nullable-type-assertion-style.md +41 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/object-curly-spacing.md +12 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/padding-line-between-statements.md +35 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/parameter-properties.md +485 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-as-const.md +44 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-enum-initializers.md +62 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-for-of.md +46 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-function-type.md +92 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-includes.md +77 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-literal-enum-member.md +101 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-namespace-keyword.md +47 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-nullish-coalescing.md +164 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-optional-chain.md +71 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-readonly-parameter-types.md +268 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-readonly.md +87 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-reduce-type-parameter.md +58 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-regexp-exec.md +46 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-return-this-type.md +87 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-string-starts-ends-with.md +57 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-ts-expect-error.md +69 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/promise-function-async.md +59 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/quotes.md +12 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/require-array-sort-compare.md +78 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/require-await.md +24 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/restrict-plus-operands.md +208 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/restrict-template-expressions.md +117 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/return-await.md +216 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/semi.md +16 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/sort-type-constituents.md +101 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/sort-type-union-intersection-members.md +106 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/space-before-blocks.md +42 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/space-before-function-paren.md +12 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/space-infix-ops.md +16 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/strict-boolean-expressions.md +183 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/switch-exhaustiveness-check.md +106 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/triple-slash-reference.md +61 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/type-annotation-spacing.md +303 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/typedef.md +320 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/unbound-method.md +103 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/unified-signatures.md +70 -0
- package/node_modules/@typescript-eslint/eslint-plugin/index.d.ts +4 -0
- package/node_modules/@typescript-eslint/eslint-plugin/package.json +87 -0
- package/node_modules/@typescript-eslint/parser/LICENSE +22 -0
- package/node_modules/@typescript-eslint/parser/README.md +10 -0
- package/node_modules/@typescript-eslint/parser/dist/index.js +17 -0
- package/node_modules/@typescript-eslint/parser/package.json +75 -0
- package/node_modules/@typescript-eslint/scope-manager/LICENSE +21 -0
- package/node_modules/@typescript-eslint/scope-manager/README.md +8 -0
- package/node_modules/@typescript-eslint/scope-manager/dist/index.js +31 -0
- package/node_modules/@typescript-eslint/scope-manager/package.json +67 -0
- package/node_modules/@typescript-eslint/type-utils/LICENSE +21 -0
- package/node_modules/@typescript-eslint/type-utils/README.md +12 -0
- package/node_modules/@typescript-eslint/type-utils/dist/index.js +36 -0
- package/node_modules/@typescript-eslint/type-utils/package.json +71 -0
- package/node_modules/@typescript-eslint/types/LICENSE +21 -0
- package/node_modules/@typescript-eslint/types/README.md +12 -0
- package/node_modules/@typescript-eslint/types/dist/index.js +24 -0
- package/node_modules/@typescript-eslint/types/package.json +84 -0
- package/node_modules/@typescript-eslint/typescript-estree/LICENSE +26 -0
- package/node_modules/@typescript-eslint/typescript-estree/README.md +10 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/index.js +38 -0
- package/node_modules/@typescript-eslint/typescript-estree/package.json +85 -0
- package/node_modules/@typescript-eslint/utils/LICENSE +21 -0
- package/node_modules/@typescript-eslint/utils/README.md +10 -0
- package/node_modules/@typescript-eslint/utils/dist/index.js +41 -0
- package/node_modules/@typescript-eslint/utils/package.json +70 -0
- package/node_modules/@typescript-eslint/visitor-keys/LICENSE +21 -0
- package/node_modules/@typescript-eslint/visitor-keys/README.md +10 -0
- package/node_modules/@typescript-eslint/visitor-keys/dist/index.js +8 -0
- package/node_modules/@typescript-eslint/visitor-keys/package.json +60 -0
- package/node_modules/@vitest/coverage-v8/LICENSE +21 -0
- package/node_modules/@vitest/coverage-v8/dist/index.js +54 -0
- package/node_modules/@vitest/coverage-v8/package.json +72 -0
- package/package.json +6 -6
- package/pnpm-lock.yaml +3277 -0
- package/src/bitsnbytes/b64.mts +158 -0
- package/src/bitsnbytes/b64.test.mts +78 -0
- package/src/bitsnbytes/index.mts +1 -0
- package/src/errors/errors.mts +271 -0
- package/src/errors/errors.test.mts +74 -0
- package/src/errors/index.mts +1 -0
- package/src/http/http-method.mts +9 -0
- package/src/http/http-status-code.mts +42 -0
- package/src/http/index.mts +2 -0
- package/src/lang/index.mts +2 -0
- package/src/lang/sleep.mts +8 -0
- package/src/lang/type-functions.mts +13 -0
- package/src/oauth/crypto-functions.mts +44 -0
- package/src/oauth/crypto-functions.test.mts +48 -0
- package/src/oauth/index.mts +1 -0
- package/src/validator/index.mts +1 -0
- package/src/validator/validators.mts +384 -0
- package/src/validator/validators.test.mts +245 -0
- package/tsconfig.json +18 -0
- /package/{bitsnbytes → dist/bitsnbytes}/b64.d.mts +0 -0
- /package/{bitsnbytes → dist/bitsnbytes}/b64.d.mts.map +0 -0
- /package/{bitsnbytes → dist/bitsnbytes}/b64.mjs +0 -0
- /package/{bitsnbytes → dist/bitsnbytes}/b64.mjs.map +0 -0
- /package/{bitsnbytes → dist/bitsnbytes}/b64.test.d.mts +0 -0
- /package/{bitsnbytes → dist/bitsnbytes}/b64.test.d.mts.map +0 -0
- /package/{bitsnbytes → dist/bitsnbytes}/b64.test.mjs +0 -0
- /package/{bitsnbytes → dist/bitsnbytes}/b64.test.mjs.map +0 -0
- /package/{bitsnbytes → dist/bitsnbytes}/index.d.mts +0 -0
- /package/{bitsnbytes → dist/bitsnbytes}/index.d.mts.map +0 -0
- /package/{bitsnbytes → dist/bitsnbytes}/index.mjs +0 -0
- /package/{bitsnbytes → dist/bitsnbytes}/index.mjs.map +0 -0
- /package/{errors → dist/errors}/errors.d.mts +0 -0
- /package/{errors → dist/errors}/errors.d.mts.map +0 -0
- /package/{errors → dist/errors}/errors.mjs +0 -0
- /package/{errors → dist/errors}/errors.mjs.map +0 -0
- /package/{errors → dist/errors}/errors.test.d.mts +0 -0
- /package/{errors → dist/errors}/errors.test.d.mts.map +0 -0
- /package/{errors → dist/errors}/errors.test.mjs +0 -0
- /package/{errors → dist/errors}/errors.test.mjs.map +0 -0
- /package/{errors → dist/errors}/index.d.mts +0 -0
- /package/{errors → dist/errors}/index.d.mts.map +0 -0
- /package/{errors → dist/errors}/index.mjs +0 -0
- /package/{errors → dist/errors}/index.mjs.map +0 -0
- /package/{http → dist/http}/http-method.d.mts +0 -0
- /package/{http → dist/http}/http-method.d.mts.map +0 -0
- /package/{http → dist/http}/http-method.mjs +0 -0
- /package/{http → dist/http}/http-method.mjs.map +0 -0
- /package/{http → dist/http}/http-status-code.d.mts +0 -0
- /package/{http → dist/http}/http-status-code.d.mts.map +0 -0
- /package/{http → dist/http}/http-status-code.mjs +0 -0
- /package/{http → dist/http}/http-status-code.mjs.map +0 -0
- /package/{http → dist/http}/index.d.mts +0 -0
- /package/{http → dist/http}/index.d.mts.map +0 -0
- /package/{http → dist/http}/index.mjs +0 -0
- /package/{http → dist/http}/index.mjs.map +0 -0
- /package/{lang → dist/lang}/index.d.mts +0 -0
- /package/{lang → dist/lang}/index.d.mts.map +0 -0
- /package/{lang → dist/lang}/index.mjs +0 -0
- /package/{lang → dist/lang}/index.mjs.map +0 -0
- /package/{lang → dist/lang}/sleep.d.mts +0 -0
- /package/{lang → dist/lang}/sleep.d.mts.map +0 -0
- /package/{lang → dist/lang}/sleep.mjs +0 -0
- /package/{lang → dist/lang}/sleep.mjs.map +0 -0
- /package/{lang → dist/lang}/type-functions.d.mts +0 -0
- /package/{lang → dist/lang}/type-functions.d.mts.map +0 -0
- /package/{lang → dist/lang}/type-functions.mjs +0 -0
- /package/{lang → dist/lang}/type-functions.mjs.map +0 -0
- /package/{oauth → dist/oauth}/crypto-functions.d.mts +0 -0
- /package/{oauth → dist/oauth}/crypto-functions.d.mts.map +0 -0
- /package/{oauth → dist/oauth}/crypto-functions.mjs +0 -0
- /package/{oauth → dist/oauth}/crypto-functions.mjs.map +0 -0
- /package/{oauth → dist/oauth}/crypto-functions.test.d.mts +0 -0
- /package/{oauth → dist/oauth}/crypto-functions.test.d.mts.map +0 -0
- /package/{oauth → dist/oauth}/crypto-functions.test.mjs +0 -0
- /package/{oauth → dist/oauth}/crypto-functions.test.mjs.map +0 -0
- /package/{oauth → dist/oauth}/index.d.mts +0 -0
- /package/{oauth → dist/oauth}/index.d.mts.map +0 -0
- /package/{oauth → dist/oauth}/index.mjs +0 -0
- /package/{oauth → dist/oauth}/index.mjs.map +0 -0
- /package/{validator → dist/validator}/index.d.mts +0 -0
- /package/{validator → dist/validator}/index.d.mts.map +0 -0
- /package/{validator → dist/validator}/index.mjs +0 -0
- /package/{validator → dist/validator}/index.mjs.map +0 -0
- /package/{validator → dist/validator}/validators.d.mts +0 -0
- /package/{validator → dist/validator}/validators.d.mts.map +0 -0
- /package/{validator → dist/validator}/validators.mjs +0 -0
- /package/{validator → dist/validator}/validators.mjs.map +0 -0
- /package/{validator → dist/validator}/validators.test.d.mts +0 -0
- /package/{validator → dist/validator}/validators.test.d.mts.map +0 -0
- /package/{validator → dist/validator}/validators.test.mjs +0 -0
- /package/{validator → dist/validator}/validators.test.mjs.map +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Disallow generic `Array` constructors.'
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
> 🛑 This file is source code, not the primary documentation location! 🛑
|
|
6
|
+
>
|
|
7
|
+
> See **https://typescript-eslint.io/rules/no-array-constructor** for documentation.
|
|
8
|
+
|
|
9
|
+
## Examples
|
|
10
|
+
|
|
11
|
+
This rule extends the base [`eslint/no-array-constructor`](https://eslint.org/docs/rules/no-array-constructor) rule.
|
|
12
|
+
It adds support for the generically typed `Array` constructor (`new Array<Foo>()`).
|
|
13
|
+
|
|
14
|
+
<!--tabs-->
|
|
15
|
+
|
|
16
|
+
### ❌ Incorrect
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
/*eslint no-array-constructor: "error"*/
|
|
20
|
+
|
|
21
|
+
Array(0, 1, 2);
|
|
22
|
+
new Array(0, 1, 2);
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### ✅ Correct
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
/*eslint no-array-constructor: "error"*/
|
|
29
|
+
|
|
30
|
+
Array<number>(0, 1, 2);
|
|
31
|
+
new Array<Foo>(x, y, z);
|
|
32
|
+
|
|
33
|
+
Array(500);
|
|
34
|
+
new Array(someOtherArray.length);
|
|
35
|
+
```
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Require `.toString()` to only be called on objects which provide useful information when stringified.'
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
> 🛑 This file is source code, not the primary documentation location! 🛑
|
|
6
|
+
>
|
|
7
|
+
> See **https://typescript-eslint.io/rules/no-base-to-string** for documentation.
|
|
8
|
+
|
|
9
|
+
JavaScript will call `toString()` on an object when it is converted to a string, such as when `+` adding to a string or in `${}` template literals.
|
|
10
|
+
The default Object `.toString()` returns `"[object Object]"`, which is often not what was intended.
|
|
11
|
+
This rule reports on stringified values that aren't primitives and don't define a more useful `.toString()` method.
|
|
12
|
+
|
|
13
|
+
> Note that `Function` provides its own `.toString()` that returns the function's code.
|
|
14
|
+
> Functions are not flagged by this rule.
|
|
15
|
+
|
|
16
|
+
## Examples
|
|
17
|
+
|
|
18
|
+
<!--tabs-->
|
|
19
|
+
|
|
20
|
+
### ❌ Incorrect
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
// Passing an object or class instance to string concatenation:
|
|
24
|
+
'' + {};
|
|
25
|
+
|
|
26
|
+
class MyClass {}
|
|
27
|
+
const value = new MyClass();
|
|
28
|
+
value + '';
|
|
29
|
+
|
|
30
|
+
// Interpolation and manual .toString() calls too:
|
|
31
|
+
`Value: ${value}`;
|
|
32
|
+
({}.toString());
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### ✅ Correct
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
// These types all have useful .toString()s
|
|
39
|
+
'Text' + true;
|
|
40
|
+
`Value: ${123}`;
|
|
41
|
+
`Arrays too: ${[1, 2, 3]}`;
|
|
42
|
+
(() => {}).toString();
|
|
43
|
+
|
|
44
|
+
// Defining a custom .toString class is considered acceptable
|
|
45
|
+
class CustomToString {
|
|
46
|
+
toString() {
|
|
47
|
+
return 'Hello, world!';
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
`Value: ${new CustomToString()}`;
|
|
51
|
+
|
|
52
|
+
const literalWithToString = {
|
|
53
|
+
toString: () => 'Hello, world!',
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
`Value: ${literalWithToString}`;
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Options
|
|
60
|
+
|
|
61
|
+
### `ignoredTypeNames`
|
|
62
|
+
|
|
63
|
+
A string array of type names to ignore, this is useful for types missing `toString()` (but actually has `toString()`).
|
|
64
|
+
There are some types missing `toString()` in old version TypeScript, like `RegExp`, `URL`, `URLSearchParams` etc.
|
|
65
|
+
|
|
66
|
+
The following patterns are considered correct with the default options `{ ignoredTypeNames: ["RegExp"] }`:
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
`${/regex/}`;
|
|
70
|
+
'' + /regex/;
|
|
71
|
+
/regex/.toString();
|
|
72
|
+
let value = /regex/;
|
|
73
|
+
value.toString();
|
|
74
|
+
let text = `${value}`;
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## When Not To Use It
|
|
78
|
+
|
|
79
|
+
If you don't mind `"[object Object]"` in your strings, then you will not need this rule.
|
|
80
|
+
|
|
81
|
+
## Related To
|
|
82
|
+
|
|
83
|
+
- [`restrict-plus-operands`](./restrict-plus-operands.md)
|
|
84
|
+
- [`restrict-template-expressions`](./restrict-template-expressions.md)
|
|
85
|
+
|
|
86
|
+
## Further Reading
|
|
87
|
+
|
|
88
|
+
- [`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/no-confusing-non-null-assertion.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Disallow non-null assertion in locations that may be confusing.'
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
> 🛑 This file is source code, not the primary documentation location! 🛑
|
|
6
|
+
>
|
|
7
|
+
> See **https://typescript-eslint.io/rules/no-confusing-non-null-assertion** for documentation.
|
|
8
|
+
|
|
9
|
+
Using a non-null assertion (`!`) next to an assign or equals check (`=` or `==` or `===`) creates code that is confusing as it looks similar to a not equals check (`!=` `!==`).
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
a! == b; // a non-null assertions(`!`) and an equals test(`==`)
|
|
13
|
+
a !== b; // not equals test(`!==`)
|
|
14
|
+
a! === b; // a non-null assertions(`!`) and an triple equals test(`===`)
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
This rule flags confusing `!` assertions and suggests either removing them or wrapping the asserted expression in `()` parenthesis.
|
|
18
|
+
|
|
19
|
+
## Examples
|
|
20
|
+
|
|
21
|
+
<!--tabs-->
|
|
22
|
+
|
|
23
|
+
### ❌ Incorrect
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
interface Foo {
|
|
27
|
+
bar?: string;
|
|
28
|
+
num?: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const foo: Foo = getFoo();
|
|
32
|
+
const isEqualsBar = foo.bar! == 'hello';
|
|
33
|
+
const isEqualsNum = 1 + foo.num! == 2;
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### ✅ Correct
|
|
37
|
+
|
|
38
|
+
<!-- prettier-ignore -->
|
|
39
|
+
```ts
|
|
40
|
+
interface Foo {
|
|
41
|
+
bar?: string;
|
|
42
|
+
num?: number;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const foo: Foo = getFoo();
|
|
46
|
+
const isEqualsBar = foo.bar == 'hello';
|
|
47
|
+
const isEqualsNum = (1 + foo.num!) == 2;
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## When Not To Use It
|
|
51
|
+
|
|
52
|
+
If you don't care about this confusion, then you will not need this rule.
|
|
53
|
+
|
|
54
|
+
## Further Reading
|
|
55
|
+
|
|
56
|
+
- [`Issue: Easy misunderstanding: "! ==="`](https://github.com/microsoft/TypeScript/issues/37837) in [TypeScript repo](https://github.com/microsoft/TypeScript)
|
package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-confusing-void-expression.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Require expressions of type void to appear in statement position.'
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
> 🛑 This file is source code, not the primary documentation location! 🛑
|
|
6
|
+
>
|
|
7
|
+
> See **https://typescript-eslint.io/rules/no-confusing-void-expression** for documentation.
|
|
8
|
+
|
|
9
|
+
`void` in TypeScript refers to a function return that is meant to be ignored.
|
|
10
|
+
Attempting to use a `void`-typed value, such as storing the result of a called function in a variable, is often a sign of a programmer error.
|
|
11
|
+
`void` can also be misleading for other developers even if used correctly.
|
|
12
|
+
|
|
13
|
+
This rule prevents `void` type expressions from being used in misleading locations such as being assigned to a variable, provided as a function argument, or returned from a function.
|
|
14
|
+
|
|
15
|
+
## Examples
|
|
16
|
+
|
|
17
|
+
<!--tabs-->
|
|
18
|
+
|
|
19
|
+
### ❌ Incorrect
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
// somebody forgot that `alert` doesn't return anything
|
|
23
|
+
const response = alert('Are you sure?');
|
|
24
|
+
console.log(alert('Are you sure?'));
|
|
25
|
+
|
|
26
|
+
// it's not obvious whether the chained promise will contain the response (fixable)
|
|
27
|
+
promise.then(value => window.postMessage(value));
|
|
28
|
+
|
|
29
|
+
// it looks like we are returning the result of `console.error` (fixable)
|
|
30
|
+
function doSomething() {
|
|
31
|
+
if (!somethingToDo) {
|
|
32
|
+
return console.error('Nothing to do!');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
console.log('Doing a thing...');
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### ✅ Correct
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
// just a regular void function in a statement position
|
|
43
|
+
alert('Hello, world!');
|
|
44
|
+
|
|
45
|
+
// this function returns a boolean value so it's ok
|
|
46
|
+
const response = confirm('Are you sure?');
|
|
47
|
+
console.log(confirm('Are you sure?'));
|
|
48
|
+
|
|
49
|
+
// now it's obvious that `postMessage` doesn't return any response
|
|
50
|
+
promise.then(value => {
|
|
51
|
+
window.postMessage(value);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// now it's explicit that we want to log the error and return early
|
|
55
|
+
function doSomething() {
|
|
56
|
+
if (!somethingToDo) {
|
|
57
|
+
console.error('Nothing to do!');
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
console.log('Doing a thing...');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// using logical expressions for their side effects is fine
|
|
65
|
+
cond && console.log('true');
|
|
66
|
+
cond || console.error('false');
|
|
67
|
+
cond ? console.log('true') : console.error('false');
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Options
|
|
71
|
+
|
|
72
|
+
### `ignoreArrowShorthand`
|
|
73
|
+
|
|
74
|
+
It might be undesirable to wrap every arrow function shorthand expression with braces.
|
|
75
|
+
Especially when using Prettier formatter, which spreads such code across 3 lines instead of 1.
|
|
76
|
+
|
|
77
|
+
Examples of additional **correct** code with this option enabled:
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
promise.then(value => window.postMessage(value));
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### `ignoreVoidOperator`
|
|
84
|
+
|
|
85
|
+
It might be preferable to only use some distinct syntax
|
|
86
|
+
to explicitly mark the confusing but valid usage of void expressions.
|
|
87
|
+
This option allows void expressions which are explicitly wrapped in the `void` operator.
|
|
88
|
+
This can help avoid confusion among other developers as long as they are made aware of this code style.
|
|
89
|
+
|
|
90
|
+
This option also changes the automatic fixes for common cases to use the `void` operator.
|
|
91
|
+
It also enables a suggestion fix to wrap the void expression with `void` operator for every problem reported.
|
|
92
|
+
|
|
93
|
+
Examples of additional **correct** code with this option enabled:
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
// now it's obvious that we don't expect any response
|
|
97
|
+
promise.then(value => void window.postMessage(value));
|
|
98
|
+
|
|
99
|
+
// now it's explicit that we don't want to return anything
|
|
100
|
+
function doSomething() {
|
|
101
|
+
if (!somethingToDo) {
|
|
102
|
+
return void console.error('Nothing to do!');
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
console.log('Doing a thing...');
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// we are sure that we want to always log `undefined`
|
|
109
|
+
console.log(void alert('Hello, world!'));
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## When Not To Use It
|
|
113
|
+
|
|
114
|
+
The return type of a function can be inspected by going to its definition or hovering over it in an IDE.
|
|
115
|
+
If you don't care about being explicit about the void type in actual code then don't use this rule.
|
|
116
|
+
Also, if you prefer concise coding style then also don't use it.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Disallow duplicate class members.'
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
> 🛑 This file is source code, not the primary documentation location! 🛑
|
|
6
|
+
>
|
|
7
|
+
> See **https://typescript-eslint.io/rules/no-dupe-class-members** for documentation.
|
|
8
|
+
|
|
9
|
+
## Examples
|
|
10
|
+
|
|
11
|
+
This rule extends the base [`eslint/no-dupe-class-members`](https://eslint.org/docs/rules/no-dupe-class-members) rule.
|
|
12
|
+
It adds support for TypeScript's method overload definitions.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Disallow duplicate enum member values.'
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
> 🛑 This file is source code, not the primary documentation location! 🛑
|
|
6
|
+
>
|
|
7
|
+
> See **https://typescript-eslint.io/rules/no-duplicate-enum-values** for documentation.
|
|
8
|
+
|
|
9
|
+
Although TypeScript supports duplicate enum member values, people usually expect members to have unique values within the same enum. Duplicate values can lead to bugs that are hard to track down.
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
|
|
13
|
+
This rule disallows defining an enum with multiple members initialized to the same value.
|
|
14
|
+
|
|
15
|
+
> This rule only enforces on enum members initialized with string or number literals.
|
|
16
|
+
> Members without an initializer or initialized with an expression are not checked by this rule.
|
|
17
|
+
|
|
18
|
+
<!--tabs-->
|
|
19
|
+
|
|
20
|
+
### ❌ Incorrect
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
enum E {
|
|
24
|
+
A = 0,
|
|
25
|
+
B = 0,
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
enum E {
|
|
31
|
+
A = 'A',
|
|
32
|
+
B = 'A',
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### ✅ Correct
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
enum E {
|
|
40
|
+
A = 0,
|
|
41
|
+
B = 1,
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
enum E {
|
|
47
|
+
A = 'A',
|
|
48
|
+
B = 'B',
|
|
49
|
+
}
|
|
50
|
+
```
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Disallow duplicate imports.'
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
> 🛑 This file is source code, not the primary documentation location! 🛑
|
|
6
|
+
>
|
|
7
|
+
> See **https://typescript-eslint.io/rules/no-duplicate-imports** for documentation.
|
|
8
|
+
|
|
9
|
+
:::danger Deprecated
|
|
10
|
+
|
|
11
|
+
This rule has been deprecated in favour of the [`import/no-duplicates`](https://github.com/import-js/eslint-plugin-import/blob/HEAD/docs/rules/no-duplicates.md) rule.
|
|
12
|
+
:::
|
package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-duplicate-type-constituents.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Disallow duplicate constituents of union or intersection types.'
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
> 🛑 This file is source code, not the primary documentation location! 🛑
|
|
6
|
+
>
|
|
7
|
+
> See **https://typescript-eslint.io/rules/no-duplicate-type-constituents** for documentation.
|
|
8
|
+
|
|
9
|
+
TypeScript supports types ("constituents") within union and intersection types being duplicates of each other.
|
|
10
|
+
However, developers typically expect each constituent to be unique within its intersection or union.
|
|
11
|
+
Duplicate values make the code overly verbose and generally reduce readability.
|
|
12
|
+
|
|
13
|
+
## Rule Details
|
|
14
|
+
|
|
15
|
+
This rule disallows duplicate union or intersection constituents.
|
|
16
|
+
We consider types to be duplicate if they evaluate to the same result in the type system.
|
|
17
|
+
For example, given `type A = string` and `type T = string | A`, this rule would flag that `A` is the same type as `string`.
|
|
18
|
+
|
|
19
|
+
<!--tabs-->
|
|
20
|
+
|
|
21
|
+
### ❌ Incorrect
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
type T1 = 'A' | 'A';
|
|
25
|
+
|
|
26
|
+
type T2 = A | A | B;
|
|
27
|
+
|
|
28
|
+
type T3 = { a: string } & { a: string };
|
|
29
|
+
|
|
30
|
+
type T4 = [1, 2, 3] | [1, 2, 3];
|
|
31
|
+
|
|
32
|
+
type StringA = string;
|
|
33
|
+
type StringB = string;
|
|
34
|
+
type T5 = StringA | StringB;
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### ✅ Correct
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
type T1 = 'A' | 'B';
|
|
41
|
+
|
|
42
|
+
type T2 = A | B | C;
|
|
43
|
+
|
|
44
|
+
type T3 = { a: string } & { b: string };
|
|
45
|
+
|
|
46
|
+
type T4 = [1, 2, 3] | [1, 2, 3, 4];
|
|
47
|
+
|
|
48
|
+
type StringA = string;
|
|
49
|
+
type NumberB = number;
|
|
50
|
+
type T5 = StringA | NumberB;
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Options
|
|
54
|
+
|
|
55
|
+
### `ignoreIntersections`
|
|
56
|
+
|
|
57
|
+
When set to true, duplicate checks on intersection type constituents are ignored.
|
|
58
|
+
|
|
59
|
+
### `ignoreUnions`
|
|
60
|
+
|
|
61
|
+
When set to true, duplicate checks on union type constituents are ignored.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Disallow using the `delete` operator on computed key expressions.'
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
> 🛑 This file is source code, not the primary documentation location! 🛑
|
|
6
|
+
>
|
|
7
|
+
> See **https://typescript-eslint.io/rules/no-dynamic-delete** for documentation.
|
|
8
|
+
|
|
9
|
+
Deleting dynamically computed keys can be dangerous and in some cases not well optimized.
|
|
10
|
+
Using the `delete` operator on keys that aren't runtime constants could be a sign that you're using the wrong data structures.
|
|
11
|
+
Using `Object`s with added and removed keys can cause occasional edge case bugs, such as if a key is named `"hasOwnProperty"`.
|
|
12
|
+
|
|
13
|
+
> Consider using a `Map` or `Set` if you’re storing collections of objects.
|
|
14
|
+
|
|
15
|
+
## Examples
|
|
16
|
+
|
|
17
|
+
<!--tabs-->
|
|
18
|
+
|
|
19
|
+
### ❌ Incorrect
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
// Can be replaced with the constant equivalents, such as container.aaa
|
|
23
|
+
delete container['aaa'];
|
|
24
|
+
delete container['Infinity'];
|
|
25
|
+
|
|
26
|
+
// Dynamic, difficult-to-reason-about lookups
|
|
27
|
+
const name = 'name';
|
|
28
|
+
delete container[name];
|
|
29
|
+
delete container[name.toUpperCase()];
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### ✅ Correct
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
const container: { [i: string]: number } = {
|
|
36
|
+
/* ... */
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// Constant runtime lookups by string index
|
|
40
|
+
delete container.aaa;
|
|
41
|
+
|
|
42
|
+
// Constants that must be accessed by []
|
|
43
|
+
delete container[7];
|
|
44
|
+
delete container['-Infinity'];
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## When Not To Use It
|
|
48
|
+
|
|
49
|
+
When you know your keys are safe to delete, this rule can be unnecessary.
|
|
50
|
+
Some environments such as older browsers might not support `Map` and `Set`.
|
|
51
|
+
|
|
52
|
+
Do not consider this rule as performance advice before profiling your code's bottlenecks.
|
|
53
|
+
Even repeated minor performance slowdowns likely do not significantly affect your application's general perceived speed.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Disallow empty functions.'
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
> 🛑 This file is source code, not the primary documentation location! 🛑
|
|
6
|
+
>
|
|
7
|
+
> See **https://typescript-eslint.io/rules/no-empty-function** for documentation.
|
|
8
|
+
|
|
9
|
+
## Examples
|
|
10
|
+
|
|
11
|
+
This rule extends the base [`eslint/no-empty-function`](https://eslint.org/docs/rules/no-empty-function) rule.
|
|
12
|
+
It adds support for handling TypeScript specific code that would otherwise trigger the rule.
|
|
13
|
+
|
|
14
|
+
One example of valid TypeScript specific code that would otherwise trigger the `no-empty-function` rule is the use of [parameter properties](https://www.typescriptlang.org/docs/handbook/classes.html#parameter-properties) in constructor functions.
|
|
15
|
+
|
|
16
|
+
## Options
|
|
17
|
+
|
|
18
|
+
This rule adds the following options:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
type AdditionalAllowOptionEntries =
|
|
22
|
+
| 'private-constructors'
|
|
23
|
+
| 'protected-constructors'
|
|
24
|
+
| 'decoratedFunctions'
|
|
25
|
+
| 'overrideMethods';
|
|
26
|
+
|
|
27
|
+
type AllowOptionEntries =
|
|
28
|
+
| BaseNoEmptyFunctionAllowOptionEntries
|
|
29
|
+
| AdditionalAllowOptionEntries;
|
|
30
|
+
|
|
31
|
+
interface Options extends BaseNoEmptyFunctionOptions {
|
|
32
|
+
allow?: Array<AllowOptionEntries>;
|
|
33
|
+
}
|
|
34
|
+
const defaultOptions: Options = {
|
|
35
|
+
...baseNoEmptyFunctionDefaultOptions,
|
|
36
|
+
allow: [],
|
|
37
|
+
};
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### allow: `private-constructors`
|
|
41
|
+
|
|
42
|
+
Examples of correct code for the `{ "allow": ["private-constructors"] }` option:
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
class Foo {
|
|
46
|
+
private constructor() {}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### allow: `protected-constructors`
|
|
51
|
+
|
|
52
|
+
Examples of correct code for the `{ "allow": ["protected-constructors"] }` option:
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
class Foo {
|
|
56
|
+
protected constructor() {}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### allow: `decoratedFunctions`
|
|
61
|
+
|
|
62
|
+
Examples of correct code for the `{ "allow": ["decoratedFunctions"] }` option:
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
@decorator()
|
|
66
|
+
function foo() {}
|
|
67
|
+
|
|
68
|
+
class Foo {
|
|
69
|
+
@decorator()
|
|
70
|
+
foo() {}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### allow: `overrideMethods`
|
|
75
|
+
|
|
76
|
+
Examples of correct code for the `{ "allow": ["overrideMethods"] }` option:
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
abstract class Base {
|
|
80
|
+
protected greet(): void {
|
|
81
|
+
console.log('Hello!');
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
class Foo extends Base {
|
|
86
|
+
protected override greet(): void {}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Disallow the declaration of empty interfaces.'
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
> 🛑 This file is source code, not the primary documentation location! 🛑
|
|
6
|
+
>
|
|
7
|
+
> See **https://typescript-eslint.io/rules/no-empty-interface** for documentation.
|
|
8
|
+
|
|
9
|
+
An empty interface in TypeScript does very little: any non-nullable value is assignable to `{}`.
|
|
10
|
+
Using an empty interface is often a sign of programmer error, such as misunderstanding the concept of `{}` or forgetting to fill in fields.
|
|
11
|
+
|
|
12
|
+
This rule aims to ensure that only meaningful interfaces are declared in the code.
|
|
13
|
+
|
|
14
|
+
## Examples
|
|
15
|
+
|
|
16
|
+
<!--tabs-->
|
|
17
|
+
|
|
18
|
+
### ❌ Incorrect
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
// an empty interface
|
|
22
|
+
interface Foo {}
|
|
23
|
+
|
|
24
|
+
// an interface with only one supertype (Bar === Foo)
|
|
25
|
+
interface Bar extends Foo {}
|
|
26
|
+
|
|
27
|
+
// an interface with an empty list of supertypes
|
|
28
|
+
interface Baz {}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### ✅ Correct
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
// an interface with any number of members
|
|
35
|
+
interface Foo {
|
|
36
|
+
name: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// same as above
|
|
40
|
+
interface Bar {
|
|
41
|
+
age: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// an interface with more than one supertype
|
|
45
|
+
// in this case the interface can be used as a replacement of an intersection type.
|
|
46
|
+
interface Baz extends Foo, Bar {}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
<!--/tabs-->
|
|
50
|
+
|
|
51
|
+
## Options
|
|
52
|
+
|
|
53
|
+
This rule accepts a single object option with the following default configuration:
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"@typescript-eslint/no-empty-interface": [
|
|
58
|
+
"error",
|
|
59
|
+
{
|
|
60
|
+
"allowSingleExtends": false
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
- `allowSingleExtends: true` will silence warnings about extending a single interface without adding additional members
|
|
67
|
+
|
|
68
|
+
## When Not To Use It
|
|
69
|
+
|
|
70
|
+
If you don't care about having empty/meaningless interfaces, then you will not need this rule.
|