@mnaoumov/typescript-dev-toolkit 0.0.0 → 1.1.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/LICENSE +21 -0
- package/README.md +15 -1
- package/bundlers/esbuild-impl/change-extension-plugin/package.json +6 -0
- package/bundlers/esbuild-impl/custom-esbuild-options-plugin/package.json +6 -0
- package/bundlers/esbuild-impl/fix-esm-plugin/package.json +6 -0
- package/bundlers/esbuild-impl/index/package.json +6 -0
- package/bundlers/esbuild-impl/package.json +6 -0
- package/bundlers/esbuild-impl/preprocess-plugin/package.json +6 -0
- package/bundlers/esbuild-impl/svelte-wrapper-plugin/package.json +6 -0
- package/bundlers/index/package.json +6 -0
- package/bundlers/package.json +6 -0
- package/dist/lib/cjs/build.cjs +191 -0
- package/dist/lib/cjs/build.d.cts +59 -0
- package/dist/lib/cjs/bundlers/esbuild-impl/change-extension-plugin.cjs +139 -0
- package/dist/lib/cjs/bundlers/esbuild-impl/change-extension-plugin.d.cts +25 -0
- package/dist/lib/cjs/bundlers/esbuild-impl/custom-esbuild-options-plugin.cjs +96 -0
- package/dist/lib/cjs/bundlers/esbuild-impl/custom-esbuild-options-plugin.d.cts +14 -0
- package/dist/lib/cjs/bundlers/esbuild-impl/fix-esm-plugin.cjs +106 -0
- package/dist/lib/cjs/bundlers/esbuild-impl/fix-esm-plugin.d.cts +13 -0
- package/dist/lib/cjs/bundlers/esbuild-impl/index.cjs +111 -0
- package/dist/lib/cjs/bundlers/esbuild-impl/index.d.cts +6 -0
- package/dist/lib/cjs/bundlers/esbuild-impl/preprocess-plugin.cjs +211 -0
- package/dist/lib/cjs/bundlers/esbuild-impl/preprocess-plugin.d.cts +143 -0
- package/dist/lib/cjs/bundlers/esbuild-impl/svelte-wrapper-plugin.cjs +129 -0
- package/dist/lib/cjs/bundlers/esbuild-impl/svelte-wrapper-plugin.d.cts +14 -0
- package/dist/lib/cjs/bundlers/index.cjs +99 -0
- package/dist/lib/cjs/bundlers/index.d.cts +2 -0
- package/dist/lib/cjs/check-project-types.cjs +163 -0
- package/dist/lib/cjs/check-project-types.d.cts +92 -0
- package/dist/lib/cjs/cli-utils.cjs +276 -0
- package/dist/lib/cjs/cli-utils.d.cts +123 -0
- package/dist/lib/cjs/code-generator.cjs +96 -0
- package/dist/lib/cjs/code-generator.d.cts +14 -0
- package/dist/lib/cjs/commitlint-config.cjs +110 -0
- package/dist/lib/cjs/commitlint-config.d.cts +14 -0
- package/dist/lib/cjs/commitlint-forbidden-patterns.cjs +110 -0
- package/dist/lib/cjs/commitlint-forbidden-patterns.d.cts +37 -0
- package/dist/lib/cjs/commitlint-spellcheck-header.cjs +126 -0
- package/dist/lib/cjs/commitlint-spellcheck-header.d.cts +40 -0
- package/dist/lib/cjs/env-toggle.cjs +133 -0
- package/dist/lib/cjs/env-toggle.d.cts +42 -0
- package/dist/lib/cjs/exec.cjs +455 -0
- package/dist/lib/cjs/exec.d.cts +162 -0
- package/dist/lib/cjs/forbidden-patterns.cjs +157 -0
- package/dist/lib/cjs/forbidden-patterns.d.cts +57 -0
- package/dist/lib/cjs/formatters/dprint.cjs +108 -0
- package/dist/lib/cjs/formatters/dprint.d.cts +33 -0
- package/dist/lib/cjs/formatters/index.cjs +99 -0
- package/dist/lib/cjs/formatters/index.d.cts +2 -0
- package/dist/lib/cjs/fs.cjs +123 -0
- package/dist/lib/cjs/fs.d.cts +80 -0
- package/dist/lib/cjs/gate.cjs +140 -0
- package/dist/lib/cjs/gate.d.cts +93 -0
- package/dist/lib/cjs/git.cjs +109 -0
- package/dist/lib/cjs/git.d.cts +37 -0
- package/dist/lib/cjs/index.cjs +186 -0
- package/dist/lib/cjs/index.d.cts +35 -0
- package/dist/lib/cjs/json.cjs +141 -0
- package/dist/lib/cjs/json.d.cts +102 -0
- package/dist/lib/cjs/library-build.cjs +483 -0
- package/dist/lib/cjs/library-build.d.cts +101 -0
- package/dist/lib/cjs/library-references.d.cts +5 -0
- package/dist/lib/cjs/linters/cspell-content.cjs +124 -0
- package/dist/lib/cjs/linters/cspell-content.d.cts +46 -0
- package/dist/lib/cjs/linters/cspell.cjs +103 -0
- package/dist/lib/cjs/linters/cspell.d.cts +36 -0
- package/dist/lib/cjs/linters/eslint-agnostic-core-boundary.cjs +94 -0
- package/dist/lib/cjs/linters/eslint-agnostic-core-boundary.d.cts +49 -0
- package/dist/lib/cjs/linters/eslint-config.cjs +1068 -0
- package/dist/lib/cjs/linters/eslint-config.d.cts +123 -0
- package/dist/lib/cjs/linters/eslint-no-restricted-syntax.cjs +130 -0
- package/dist/lib/cjs/linters/eslint-no-restricted-syntax.d.cts +27 -0
- package/dist/lib/cjs/linters/eslint-rules/in-house-plugin.cjs +116 -0
- package/dist/lib/cjs/linters/eslint-rules/in-house-plugin.d.cts +26 -0
- package/dist/lib/cjs/linters/eslint-rules/index.cjs +132 -0
- package/dist/lib/cjs/linters/eslint-rules/index.d.cts +13 -0
- package/dist/lib/cjs/linters/eslint-rules/no-async-callback-to-unsafe-return.cjs +175 -0
- package/dist/lib/cjs/linters/eslint-rules/no-async-callback-to-unsafe-return.d.cts +10 -0
- package/dist/lib/cjs/linters/eslint-rules/no-unresolved-jsdoc-link.cjs +290 -0
- package/dist/lib/cjs/linters/eslint-rules/no-unresolved-jsdoc-link.d.cts +10 -0
- package/dist/lib/cjs/linters/eslint-rules/no-unused-params-members.cjs +265 -0
- package/dist/lib/cjs/linters/eslint-rules/no-unused-params-members.d.cts +41 -0
- package/dist/lib/cjs/linters/eslint-rules/no-used-underscore-variables.cjs +134 -0
- package/dist/lib/cjs/linters/eslint-rules/no-used-underscore-variables.d.cts +20 -0
- package/dist/lib/cjs/linters/eslint-rules/params-options-name-match.cjs +217 -0
- package/dist/lib/cjs/linters/eslint-rules/params-options-name-match.d.cts +36 -0
- package/dist/lib/cjs/linters/eslint-rules/prefer-noop-async.cjs +126 -0
- package/dist/lib/cjs/linters/eslint-rules/prefer-noop-async.d.cts +10 -0
- package/dist/lib/cjs/linters/eslint-rules/readonly-params-options-result-members.cjs +125 -0
- package/dist/lib/cjs/linters/eslint-rules/readonly-params-options-result-members.d.cts +20 -0
- package/dist/lib/cjs/linters/eslint-rules/require-method-template.cjs +181 -0
- package/dist/lib/cjs/linters/eslint-rules/require-method-template.d.cts +14 -0
- package/dist/lib/cjs/linters/eslint-rules/require-super-call.cjs +217 -0
- package/dist/lib/cjs/linters/eslint-rules/require-super-call.d.cts +10 -0
- package/dist/lib/cjs/linters/eslint-rules/rule-tester-helper.cjs +92 -0
- package/dist/lib/cjs/linters/eslint-rules/rule-tester-helper.d.cts +18 -0
- package/dist/lib/cjs/linters/eslint-rules/ts-estree-node.cjs +92 -0
- package/dist/lib/cjs/linters/eslint-rules/ts-estree-node.d.cts +23 -0
- package/dist/lib/cjs/linters/eslint-types/@types/@eslint-community__eslint-plugin-eslint-comments__configs.d.cts +20 -0
- package/dist/lib/cjs/linters/eslint-types/@types/eslint-plugin-verify-tsdoc.d.cts +17 -0
- package/dist/lib/cjs/linters/eslint.cjs +196 -0
- package/dist/lib/cjs/linters/eslint.d.cts +74 -0
- package/dist/lib/cjs/linters/index.cjs +138 -0
- package/dist/lib/cjs/linters/index.d.cts +15 -0
- package/dist/lib/cjs/linters/lint-ignores.cjs +91 -0
- package/dist/lib/cjs/linters/lint-ignores.d.cts +30 -0
- package/dist/lib/cjs/linters/markdownlint-cli2-config.cjs +169 -0
- package/dist/lib/cjs/linters/markdownlint-cli2-config.d.cts +11 -0
- package/dist/lib/cjs/linters/markdownlint-content.cjs +120 -0
- package/dist/lib/cjs/linters/markdownlint-content.d.cts +47 -0
- package/dist/lib/cjs/linters/markdownlint-ignores.cjs +95 -0
- package/dist/lib/cjs/linters/markdownlint-ignores.d.cts +35 -0
- package/dist/lib/cjs/linters/markdownlint-rules/index.cjs +99 -0
- package/dist/lib/cjs/linters/markdownlint-rules/index.d.cts +2 -0
- package/dist/lib/cjs/linters/markdownlint-rules/no-soft-break-in-paragraph.cjs +152 -0
- package/dist/lib/cjs/linters/markdownlint-rules/no-soft-break-in-paragraph.d.cts +35 -0
- package/dist/lib/cjs/linters/markdownlint-types/@types/markdownlint-cli2-config-schema.d.cts +1344 -0
- package/dist/lib/cjs/linters/markdownlint-types/@types/markdownlint-cli2.d.cts +67 -0
- package/dist/lib/cjs/linters/markdownlint.cjs +151 -0
- package/dist/lib/cjs/linters/markdownlint.d.cts +32 -0
- package/dist/lib/cjs/linters/over-exposure.cjs +685 -0
- package/dist/lib/cjs/linters/over-exposure.d.cts +357 -0
- package/dist/lib/cjs/nano-staged-config.cjs +148 -0
- package/dist/lib/cjs/nano-staged-config.d.cts +54 -0
- package/dist/lib/cjs/npm-publish.cjs +93 -0
- package/dist/lib/cjs/npm-publish.d.cts +19 -0
- package/dist/lib/cjs/npm-run.cjs +120 -0
- package/dist/lib/cjs/npm-run.d.cts +34 -0
- package/dist/lib/cjs/npm.cjs +200 -0
- package/dist/lib/cjs/npm.d.cts +168 -0
- package/dist/lib/cjs/package-lock-integrity.cjs +134 -0
- package/dist/lib/cjs/package-lock-integrity.d.cts +38 -0
- package/dist/lib/cjs/package-manager.cjs +291 -0
- package/dist/lib/cjs/package-manager.d.cts +93 -0
- package/dist/lib/cjs/released-issues.cjs +178 -0
- package/dist/lib/cjs/released-issues.d.cts +79 -0
- package/dist/lib/cjs/repo-paths.cjs +167 -0
- package/dist/lib/cjs/repo-paths.d.cts +318 -0
- package/dist/lib/cjs/root.cjs +150 -0
- package/dist/lib/cjs/root.d.cts +107 -0
- package/dist/lib/cjs/test-runners/index.cjs +102 -0
- package/dist/lib/cjs/test-runners/index.d.cts +3 -0
- package/dist/lib/cjs/test-runners/vitest-config.cjs +126 -0
- package/dist/lib/cjs/test-runners/vitest-config.d.cts +90 -0
- package/dist/lib/cjs/test-runners/vitest.cjs +115 -0
- package/dist/lib/cjs/test-runners/vitest.d.cts +52 -0
- package/dist/lib/cjs/validate-declarations.cjs +120 -0
- package/dist/lib/cjs/validate-declarations.d.cts +37 -0
- package/dist/lib/cjs/version.cjs +758 -0
- package/dist/lib/cjs/version.d.cts +418 -0
- package/dist/lib/esm/build.d.mts +59 -0
- package/dist/lib/esm/build.mjs +165 -0
- package/dist/lib/esm/bundlers/esbuild-impl/change-extension-plugin.d.mts +25 -0
- package/dist/lib/esm/bundlers/esbuild-impl/change-extension-plugin.mjs +101 -0
- package/dist/lib/esm/bundlers/esbuild-impl/custom-esbuild-options-plugin.d.mts +14 -0
- package/dist/lib/esm/bundlers/esbuild-impl/custom-esbuild-options-plugin.mjs +59 -0
- package/dist/lib/esm/bundlers/esbuild-impl/fix-esm-plugin.d.mts +13 -0
- package/dist/lib/esm/bundlers/esbuild-impl/fix-esm-plugin.mjs +69 -0
- package/dist/lib/esm/bundlers/esbuild-impl/index.d.mts +6 -0
- package/dist/lib/esm/bundlers/esbuild-impl/index.mjs +60 -0
- package/dist/lib/esm/bundlers/esbuild-impl/preprocess-plugin.d.mts +143 -0
- package/dist/lib/esm/bundlers/esbuild-impl/preprocess-plugin.mjs +176 -0
- package/dist/lib/esm/bundlers/esbuild-impl/svelte-wrapper-plugin.d.mts +14 -0
- package/dist/lib/esm/bundlers/esbuild-impl/svelte-wrapper-plugin.mjs +82 -0
- package/dist/lib/esm/bundlers/index.d.mts +2 -0
- package/dist/lib/esm/bundlers/index.mjs +52 -0
- package/dist/lib/esm/check-project-types.d.mts +92 -0
- package/dist/lib/esm/check-project-types.mjs +123 -0
- package/dist/lib/esm/cli-utils.d.mts +123 -0
- package/dist/lib/esm/cli-utils.mjs +225 -0
- package/dist/lib/esm/code-generator.d.mts +14 -0
- package/dist/lib/esm/code-generator.mjs +59 -0
- package/dist/lib/esm/commitlint-config.d.mts +14 -0
- package/dist/lib/esm/commitlint-config.mjs +79 -0
- package/dist/lib/esm/commitlint-forbidden-patterns.d.mts +37 -0
- package/dist/lib/esm/commitlint-forbidden-patterns.mjs +75 -0
- package/dist/lib/esm/commitlint-spellcheck-header.d.mts +40 -0
- package/dist/lib/esm/commitlint-spellcheck-header.mjs +87 -0
- package/dist/lib/esm/env-toggle.d.mts +42 -0
- package/dist/lib/esm/env-toggle.mjs +84 -0
- package/dist/lib/esm/exec.d.mts +162 -0
- package/dist/lib/esm/exec.mjs +410 -0
- package/dist/lib/esm/forbidden-patterns.d.mts +57 -0
- package/dist/lib/esm/forbidden-patterns.mjs +108 -0
- package/dist/lib/esm/formatters/dprint.d.mts +33 -0
- package/dist/lib/esm/formatters/dprint.mjs +75 -0
- package/dist/lib/esm/formatters/index.d.mts +2 -0
- package/dist/lib/esm/formatters/index.mjs +52 -0
- package/dist/lib/esm/fs.d.mts +80 -0
- package/dist/lib/esm/fs.mjs +89 -0
- package/dist/lib/esm/gate.d.mts +93 -0
- package/dist/lib/esm/gate.mjs +106 -0
- package/dist/lib/esm/git.d.mts +37 -0
- package/dist/lib/esm/git.mjs +72 -0
- package/dist/lib/esm/index.d.mts +35 -0
- package/dist/lib/esm/index.mjs +110 -0
- package/dist/lib/esm/json.d.mts +102 -0
- package/dist/lib/esm/json.mjs +106 -0
- package/dist/lib/esm/library-build.d.mts +101 -0
- package/dist/lib/esm/library-build.mjs +443 -0
- package/dist/lib/esm/library-references.d.mts +5 -0
- package/dist/lib/esm/linters/cspell-content.d.mts +46 -0
- package/dist/lib/esm/linters/cspell-content.mjs +87 -0
- package/dist/lib/esm/linters/cspell.d.mts +36 -0
- package/dist/lib/esm/linters/cspell.mjs +69 -0
- package/dist/lib/esm/linters/eslint-agnostic-core-boundary.d.mts +49 -0
- package/dist/lib/esm/linters/eslint-agnostic-core-boundary.mjs +57 -0
- package/dist/lib/esm/linters/eslint-config.d.mts +123 -0
- package/dist/lib/esm/linters/eslint-config.mjs +1022 -0
- package/dist/lib/esm/linters/eslint-no-restricted-syntax.d.mts +27 -0
- package/dist/lib/esm/linters/eslint-no-restricted-syntax.mjs +93 -0
- package/dist/lib/esm/linters/eslint-rules/in-house-plugin.d.mts +26 -0
- package/dist/lib/esm/linters/eslint-rules/in-house-plugin.mjs +77 -0
- package/dist/lib/esm/linters/eslint-rules/index.d.mts +13 -0
- package/dist/lib/esm/linters/eslint-rules/index.mjs +74 -0
- package/dist/lib/esm/linters/eslint-rules/no-async-callback-to-unsafe-return.d.mts +10 -0
- package/dist/lib/esm/linters/eslint-rules/no-async-callback-to-unsafe-return.mjs +144 -0
- package/dist/lib/esm/linters/eslint-rules/no-unresolved-jsdoc-link.d.mts +10 -0
- package/dist/lib/esm/linters/eslint-rules/no-unresolved-jsdoc-link.mjs +277 -0
- package/dist/lib/esm/linters/eslint-rules/no-unused-params-members.d.mts +41 -0
- package/dist/lib/esm/linters/eslint-rules/no-unused-params-members.mjs +227 -0
- package/dist/lib/esm/linters/eslint-rules/no-used-underscore-variables.d.mts +20 -0
- package/dist/lib/esm/linters/eslint-rules/no-used-underscore-variables.mjs +96 -0
- package/dist/lib/esm/linters/eslint-rules/params-options-name-match.d.mts +36 -0
- package/dist/lib/esm/linters/eslint-rules/params-options-name-match.mjs +179 -0
- package/dist/lib/esm/linters/eslint-rules/prefer-noop-async.d.mts +10 -0
- package/dist/lib/esm/linters/eslint-rules/prefer-noop-async.mjs +88 -0
- package/dist/lib/esm/linters/eslint-rules/readonly-params-options-result-members.d.mts +20 -0
- package/dist/lib/esm/linters/eslint-rules/readonly-params-options-result-members.mjs +87 -0
- package/dist/lib/esm/linters/eslint-rules/require-method-template.d.mts +14 -0
- package/dist/lib/esm/linters/eslint-rules/require-method-template.mjs +142 -0
- package/dist/lib/esm/linters/eslint-rules/require-super-call.d.mts +10 -0
- package/dist/lib/esm/linters/eslint-rules/require-super-call.mjs +183 -0
- package/dist/lib/esm/linters/eslint-rules/rule-tester-helper.d.mts +18 -0
- package/dist/lib/esm/linters/eslint-rules/rule-tester-helper.mjs +55 -0
- package/dist/lib/esm/linters/eslint-rules/ts-estree-node.d.mts +23 -0
- package/dist/lib/esm/linters/eslint-rules/ts-estree-node.mjs +55 -0
- package/dist/lib/esm/linters/eslint-types/@types/@eslint-community__eslint-plugin-eslint-comments__configs.d.mts +20 -0
- package/dist/lib/esm/linters/eslint-types/@types/eslint-plugin-verify-tsdoc.d.mts +17 -0
- package/dist/lib/esm/linters/eslint.d.mts +74 -0
- package/dist/lib/esm/linters/eslint.mjs +159 -0
- package/dist/lib/esm/linters/index.d.mts +15 -0
- package/dist/lib/esm/linters/index.mjs +78 -0
- package/dist/lib/esm/linters/lint-ignores.d.mts +30 -0
- package/dist/lib/esm/linters/lint-ignores.mjs +54 -0
- package/dist/lib/esm/linters/markdownlint-cli2-config.d.mts +11 -0
- package/dist/lib/esm/linters/markdownlint-cli2-config.mjs +122 -0
- package/dist/lib/esm/linters/markdownlint-content.d.mts +47 -0
- package/dist/lib/esm/linters/markdownlint-content.mjs +83 -0
- package/dist/lib/esm/linters/markdownlint-ignores.d.mts +35 -0
- package/dist/lib/esm/linters/markdownlint-ignores.mjs +57 -0
- package/dist/lib/esm/linters/markdownlint-rules/index.d.mts +2 -0
- package/dist/lib/esm/linters/markdownlint-rules/index.mjs +52 -0
- package/dist/lib/esm/linters/markdownlint-rules/no-soft-break-in-paragraph.d.mts +35 -0
- package/dist/lib/esm/linters/markdownlint-rules/no-soft-break-in-paragraph.mjs +114 -0
- package/dist/lib/esm/linters/markdownlint-types/@types/markdownlint-cli2-config-schema.d.mts +1344 -0
- package/dist/lib/esm/linters/markdownlint-types/@types/markdownlint-cli2.d.mts +67 -0
- package/dist/lib/esm/linters/markdownlint.d.mts +32 -0
- package/dist/lib/esm/linters/markdownlint.mjs +124 -0
- package/dist/lib/esm/linters/over-exposure.d.mts +357 -0
- package/dist/lib/esm/linters/over-exposure.mjs +672 -0
- package/dist/lib/esm/nano-staged-config.d.mts +54 -0
- package/dist/lib/esm/nano-staged-config.mjs +103 -0
- package/dist/lib/esm/npm-publish.d.mts +19 -0
- package/dist/lib/esm/npm-publish.mjs +56 -0
- package/dist/lib/esm/npm-run.d.mts +34 -0
- package/dist/lib/esm/npm-run.mjs +81 -0
- package/dist/lib/esm/npm.d.mts +168 -0
- package/dist/lib/esm/npm.mjs +155 -0
- package/dist/lib/esm/package-lock-integrity.d.mts +38 -0
- package/dist/lib/esm/package-lock-integrity.mjs +99 -0
- package/dist/lib/esm/package-manager.d.mts +93 -0
- package/dist/lib/esm/package-manager.mjs +245 -0
- package/dist/lib/esm/released-issues.d.mts +79 -0
- package/dist/lib/esm/released-issues.mjs +143 -0
- package/dist/lib/esm/repo-paths.d.mts +318 -0
- package/dist/lib/esm/repo-paths.mjs +130 -0
- package/dist/lib/esm/root.d.mts +107 -0
- package/dist/lib/esm/root.mjs +115 -0
- package/dist/lib/esm/test-runners/index.d.mts +3 -0
- package/dist/lib/esm/test-runners/index.mjs +54 -0
- package/dist/lib/esm/test-runners/vitest-config.d.mts +90 -0
- package/dist/lib/esm/test-runners/vitest-config.mjs +86 -0
- package/dist/lib/esm/test-runners/vitest.d.mts +52 -0
- package/dist/lib/esm/test-runners/vitest.mjs +76 -0
- package/dist/lib/esm/validate-declarations.d.mts +37 -0
- package/dist/lib/esm/validate-declarations.mjs +87 -0
- package/dist/lib/esm/version.d.mts +418 -0
- package/dist/lib/esm/version.mjs +723 -0
- package/formatters/dprint/package.json +6 -0
- package/formatters/index/package.json +6 -0
- package/formatters/package.json +6 -0
- package/linters/cspell/package.json +6 -0
- package/linters/cspell-content/package.json +6 -0
- package/linters/eslint/package.json +6 -0
- package/linters/eslint-agnostic-core-boundary/package.json +6 -0
- package/linters/eslint-config/package.json +6 -0
- package/linters/eslint-no-restricted-syntax/package.json +6 -0
- package/linters/eslint-rules/in-house-plugin/package.json +6 -0
- package/linters/eslint-rules/index/package.json +6 -0
- package/linters/eslint-rules/no-async-callback-to-unsafe-return/package.json +6 -0
- package/linters/eslint-rules/no-unresolved-jsdoc-link/package.json +6 -0
- package/linters/eslint-rules/no-unused-params-members/package.json +6 -0
- package/linters/eslint-rules/no-used-underscore-variables/package.json +6 -0
- package/linters/eslint-rules/package.json +6 -0
- package/linters/eslint-rules/params-options-name-match/package.json +6 -0
- package/linters/eslint-rules/prefer-noop-async/package.json +6 -0
- package/linters/eslint-rules/readonly-params-options-result-members/package.json +6 -0
- package/linters/eslint-rules/require-method-template/package.json +6 -0
- package/linters/eslint-rules/require-super-call/package.json +6 -0
- package/linters/eslint-rules/rule-tester-helper/package.json +6 -0
- package/linters/eslint-rules/ts-estree-node/package.json +6 -0
- package/linters/eslint-types/@types/@eslint-community__eslint-plugin-eslint-comments__configs/package.json +4 -0
- package/linters/eslint-types/@types/eslint-plugin-verify-tsdoc/package.json +4 -0
- package/linters/index/package.json +6 -0
- package/linters/lint-ignores/package.json +6 -0
- package/linters/markdownlint/package.json +6 -0
- package/linters/markdownlint-cli2-config/package.json +6 -0
- package/linters/markdownlint-content/package.json +6 -0
- package/linters/markdownlint-ignores/package.json +6 -0
- package/linters/markdownlint-rules/index/package.json +6 -0
- package/linters/markdownlint-rules/no-soft-break-in-paragraph/package.json +6 -0
- package/linters/markdownlint-rules/package.json +6 -0
- package/linters/markdownlint-types/@types/markdownlint-cli2/package.json +4 -0
- package/linters/markdownlint-types/@types/markdownlint-cli2-config-schema/package.json +4 -0
- package/linters/over-exposure/package.json +6 -0
- package/linters/package.json +6 -0
- package/package.json +329 -13
- package/test-runners/index/package.json +6 -0
- package/test-runners/package.json +6 -0
- package/test-runners/vitest/package.json +6 -0
- package/test-runners/vitest-config/package.json +6 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/// <reference path="../../../library-references.d.mts" />
|
|
2
|
+
/**
|
|
3
|
+
* @file
|
|
4
|
+
*
|
|
5
|
+
* The types for `markdownlint-cli2`'s programmatic entry point, which the package itself describes in JSDoc
|
|
6
|
+
* and ships no declaration for. Vendored here, beside the configuration-schema types, for the same reason.
|
|
7
|
+
*
|
|
8
|
+
* Only the parameters {@link lintMarkdownContent} passes are declared. The full parameter object also carries
|
|
9
|
+
* `argv`, `allowStdin`, `fileContents`, `fs`, `noImport` and `optionsOverride`, none of which a caller linting
|
|
10
|
+
* one in-memory document has any use for — and declaring an option nobody passes is a claim about a shape
|
|
11
|
+
* nothing here ever checks.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
declare module 'markdownlint-cli2' {
|
|
15
|
+
/**
|
|
16
|
+
* The parameters of {@link main}.
|
|
17
|
+
*/
|
|
18
|
+
interface MarkdownlintCli2Parameters {
|
|
19
|
+
/**
|
|
20
|
+
* The directory whose `markdownlint-cli2` configuration applies, and the base every reported path is
|
|
21
|
+
* relative to.
|
|
22
|
+
*
|
|
23
|
+
* @default `process.cwd()`
|
|
24
|
+
*/
|
|
25
|
+
readonly directory?: string | undefined;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Called once per finding, with the line the default output formatter would have printed.
|
|
29
|
+
*/
|
|
30
|
+
readonly logError?: ((message: string) => void) | undefined;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Called with the banner and the progress lines — everything that is not a finding.
|
|
34
|
+
*/
|
|
35
|
+
readonly logMessage?: ((message: string) => void) | undefined;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Whether to skip glob expansion entirely, including the `globs` the configuration declares. Set it when
|
|
39
|
+
* the only input is {@link nonFileContents}, so the run cannot wander into the repository's own files.
|
|
40
|
+
*
|
|
41
|
+
* @default `false`
|
|
42
|
+
*/
|
|
43
|
+
readonly noGlobs?: boolean | undefined;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Content to lint that is not read from disk, keyed by the POSIX path it is linted AS. The path decides
|
|
47
|
+
* which directory's configuration applies and how the path-relative rules (such as `relative-links`)
|
|
48
|
+
* resolve, so it should be the path the content is destined for.
|
|
49
|
+
*/
|
|
50
|
+
readonly nonFileContents?: Record<string, string> | undefined;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The options the discovered configuration is merged OVER — a base, not an override. `config` is merged
|
|
54
|
+
* key by key and every other option is replaced wholesale, so anything the repository states itself wins.
|
|
55
|
+
*/
|
|
56
|
+
readonly optionsDefault?: import('./markdownlint-cli2-config-schema.d.mjs').MarkdownlintCli2ConfigurationSchema | undefined;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Runs `markdownlint-cli2`.
|
|
61
|
+
*
|
|
62
|
+
* @param parameters - The {@link MarkdownlintCli2Parameters}.
|
|
63
|
+
* @returns A {@link Promise} that resolves to the process exit code: `0` when nothing was reported, `1`
|
|
64
|
+
* when something was, `2` when the run itself failed.
|
|
65
|
+
*/
|
|
66
|
+
export function main(parameters: MarkdownlintCli2Parameters): Promise<number>;
|
|
67
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/// <reference path="../library-references.d.mts" />
|
|
2
|
+
/**
|
|
3
|
+
* @file
|
|
4
|
+
*
|
|
5
|
+
* Lint markdown documentation using `markdownlint-cli2` and `linkinator`.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Parameters for the {@link lint} function.
|
|
9
|
+
*/
|
|
10
|
+
export interface LintOptions {
|
|
11
|
+
/**
|
|
12
|
+
* The configuration file copied to the project root when the project has none. Without it,
|
|
13
|
+
* `markdownlint-cli2` runs with its own defaults.
|
|
14
|
+
*/
|
|
15
|
+
readonly defaultConfigFilePath?: string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Optional file paths to lint. If omitted, lints the entire project.
|
|
18
|
+
*/
|
|
19
|
+
readonly paths?: string[] | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Whether to fix linting issues automatically.
|
|
22
|
+
*
|
|
23
|
+
* @default `false`
|
|
24
|
+
*/
|
|
25
|
+
readonly shouldFix?: boolean | undefined;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Lint markdown documentation using `markdownlint-cli2` and `linkinator`.
|
|
29
|
+
*
|
|
30
|
+
* @param options - The {@link LintOptions}.
|
|
31
|
+
*/
|
|
32
|
+
export declare function lint(options?: LintOptions): Promise<void>;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/*
|
|
2
|
+
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|
3
|
+
if you want to view the source, please visit the github repository of this plugin
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
(function () {
|
|
7
|
+
function ensureDisposeSymbols(symbolConstructor = Symbol) {
|
|
8
|
+
symbolConstructor.asyncDispose ??= symbolConstructor.for('Symbol.asyncDispose');
|
|
9
|
+
symbolConstructor.dispose ??= symbolConstructor.for('Symbol.dispose');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function ensureBrowserProcess() {
|
|
13
|
+
const browserProcess = {
|
|
14
|
+
browser: true,
|
|
15
|
+
cwd() {
|
|
16
|
+
return '/';
|
|
17
|
+
},
|
|
18
|
+
env: {},
|
|
19
|
+
platform: 'android'
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const existingProcess = globalThis.process;
|
|
23
|
+
|
|
24
|
+
if (!existingProcess) {
|
|
25
|
+
globalThis.process = browserProcess;
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (existingProcess.versions?.node) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const existingProcessRecord = existingProcess;
|
|
34
|
+
|
|
35
|
+
for (const [key, value] of Object.entries(browserProcess)) {
|
|
36
|
+
existingProcessRecord[key] ??= value;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
existingProcessRecord['browser'] = true;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
(function initEsm() {
|
|
43
|
+
ensureDisposeSymbols();
|
|
44
|
+
ensureBrowserProcess();
|
|
45
|
+
})();
|
|
46
|
+
})();
|
|
47
|
+
|
|
48
|
+
import { toArray } from "@mnaoumov/typescript-lib/async";
|
|
49
|
+
import { getLibDebugger } from "@mnaoumov/typescript-lib/debug";
|
|
50
|
+
import { basename } from "@mnaoumov/typescript-lib/path";
|
|
51
|
+
import { existsSync } from "node:fs";
|
|
52
|
+
import {
|
|
53
|
+
cp,
|
|
54
|
+
glob
|
|
55
|
+
} from "node:fs/promises";
|
|
56
|
+
import { relative } from "node:path";
|
|
57
|
+
import { getNonIgnoredFiles } from "../git.mjs";
|
|
58
|
+
import { resolveToolCommand } from "../package-manager.mjs";
|
|
59
|
+
import { RepoPaths } from "../repo-paths.mjs";
|
|
60
|
+
import {
|
|
61
|
+
execFromRoot,
|
|
62
|
+
getRootFolder,
|
|
63
|
+
resolvePathFromRootSafe
|
|
64
|
+
} from "../root.mjs";
|
|
65
|
+
import {
|
|
66
|
+
checkIsInNodeModules,
|
|
67
|
+
NODE_MODULES_IGNORE_GLOB
|
|
68
|
+
} from "./markdownlint-ignores.mjs";
|
|
69
|
+
async function lint(options) {
|
|
70
|
+
const { defaultConfigFilePath, paths, shouldFix = false } = options ?? {};
|
|
71
|
+
const configFiles = [
|
|
72
|
+
RepoPaths.MarkdownlintCli2ConfigJsonc,
|
|
73
|
+
RepoPaths.MarkdownlintCli2ConfigYaml,
|
|
74
|
+
RepoPaths.MarkdownlintCli2ConfigCjs,
|
|
75
|
+
RepoPaths.MarkdownlintCli2ConfigMjs,
|
|
76
|
+
RepoPaths.MarkdownlintConfigJsonc,
|
|
77
|
+
RepoPaths.MarkdownlintConfigJson,
|
|
78
|
+
RepoPaths.MarkdownlintConfigYaml,
|
|
79
|
+
RepoPaths.MarkdownlintConfigYml,
|
|
80
|
+
RepoPaths.MarkdownlintConfigCjs,
|
|
81
|
+
RepoPaths.MarkdownlintConfigMjs
|
|
82
|
+
];
|
|
83
|
+
const doesConfigFileExist = configFiles.some((configFile) => {
|
|
84
|
+
const configFilePath = resolvePathFromRootSafe({ path: configFile });
|
|
85
|
+
return existsSync(configFilePath);
|
|
86
|
+
});
|
|
87
|
+
if (!doesConfigFileExist && defaultConfigFilePath) {
|
|
88
|
+
getLibDebugger("markdownlint:lint")("markdownlint configuration file not found. Creating default config...");
|
|
89
|
+
await cp(defaultConfigFilePath, resolvePathFromRootSafe({ path: basename(defaultConfigFilePath) }));
|
|
90
|
+
}
|
|
91
|
+
const targets = paths?.length ? paths : [RepoPaths.CurrentFolder];
|
|
92
|
+
await execFromRoot([...resolveToolCommand({ tool: "markdownlint-cli2" }), ...shouldFix ? ["--fix"] : [], { batchedArguments: targets }]);
|
|
93
|
+
const rootFolder = getRootFolder() ?? process.cwd();
|
|
94
|
+
const mdFiles = paths?.length ? paths.map((p) => relative(rootFolder, p).replaceAll("\\", "/") || p) : await getMarkdownFiles();
|
|
95
|
+
await execFromRoot([
|
|
96
|
+
...resolveToolCommand({ tool: "linkinator" }),
|
|
97
|
+
"--retry",
|
|
98
|
+
"--retry-errors",
|
|
99
|
+
"--retry-errors-count",
|
|
100
|
+
"3",
|
|
101
|
+
"--retry-errors-jitter",
|
|
102
|
+
"5",
|
|
103
|
+
"--url-rewrite-search",
|
|
104
|
+
String.raw`https://www\.npmjs\.com/package/`,
|
|
105
|
+
"--url-rewrite-replace",
|
|
106
|
+
"https://registry.npmjs.org/",
|
|
107
|
+
{ batchedArguments: mdFiles }
|
|
108
|
+
]);
|
|
109
|
+
}
|
|
110
|
+
const MARKDOWN_PATHSPEC = "*.md";
|
|
111
|
+
async function getMarkdownFiles() {
|
|
112
|
+
const nonIgnoredFiles = await getNonIgnoredFiles({ patterns: [MARKDOWN_PATHSPEC] });
|
|
113
|
+
return nonIgnoredFiles ? nonIgnoredFiles.filter((path) => !checkIsInNodeModules(path)) : await toArray(glob(["**/*.md"], {
|
|
114
|
+
exclude: [
|
|
115
|
+
".git/**",
|
|
116
|
+
"dist/**",
|
|
117
|
+
NODE_MODULES_IGNORE_GLOB
|
|
118
|
+
]
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
lint
|
|
123
|
+
};
|
|
124
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vLi4vc3JjL2xpbnRlcnMvbWFya2Rvd25saW50LnRzIl0sCiAgInNvdXJjZXNDb250ZW50Ijog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QUEsSUFDQSxPQUFPO0FBQUEsSUFDUDtBQUFBLElBQ0E7QUFBQSxJQUNBLEVBQUUsa0JBQWtCLFFBQVE7QUFBQSxFQUM5QixDQUFDO0FBQ0g7QUFLQSxNQUFNLG9CQUFvQjtBQWlCMUIsZUFBZSxtQkFBc0M7QUFDbkQsUUFBTSxrQkFBa0IsTUFBTSxtQkFBbUIsRUFBRSxVQUFVLENBQUMsaUJBQWlCLEVBQUUsQ0FBQztBQUNsRixTQUFPLGtCQUNILGdCQUFnQixPQUFPLENBQUMsU0FBUyxDQUFDLHFCQUFxQixJQUFJLENBQUMsSUFDM0QsTUFBTSxRQUFRLEtBQUssQ0FBQyxTQUFTLEdBQUc7QUFBQSxJQUNqQyxTQUFTO0FBQUEsTUFDUDtBQUFBLE1BQ0E7QUFBQSxNQUNBO0FBQUEsSUFDRjtBQUFBLEVBQ0YsQ0FBQyxDQUFDO0FBQ047IiwKICAibmFtZXMiOiBbXQp9Cg==
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
/// <reference path="../library-references.d.mts" />
|
|
2
|
+
/**
|
|
3
|
+
* @file
|
|
4
|
+
*
|
|
5
|
+
* Over-exposure analyzer.
|
|
6
|
+
*
|
|
7
|
+
* Finds declarations exposed more broadly than their references require, so the exposure can be
|
|
8
|
+
* tightened:
|
|
9
|
+
*
|
|
10
|
+
* - `export`ed symbols referenced only within their own file — the `export` can be dropped.
|
|
11
|
+
* - `public` class members referenced only inside their own class — they can be `private`.
|
|
12
|
+
* - `public` class members referenced only inside their own class and its subclasses — they can be
|
|
13
|
+
* `protected`.
|
|
14
|
+
* - `protected` class members referenced only inside their own class — they can be `private`.
|
|
15
|
+
*
|
|
16
|
+
* The analysis is whole-program and type-aware: it uses the TypeScript language service's
|
|
17
|
+
* find-all-references to locate every use of each declaration, then classifies the tightest
|
|
18
|
+
* exposure that still covers all references. Because `findReferences` does not link a string-literal
|
|
19
|
+
* argument back to a member declaration when the parameter is a conditional/mapped key type (e.g.
|
|
20
|
+
* `bind(component, 'someSetting')` where the key is typed `ConditionalKeys<Settings, …>`), member
|
|
21
|
+
* analysis additionally treats a string literal whose text equals the member name as a reference —
|
|
22
|
+
* but only when its contextual type is a string-literal type (or union of them) all of whose members
|
|
23
|
+
* are keys of the declaring class, so incidental same-named strings (`console.log('name')`) are not
|
|
24
|
+
* miscounted. Members invoked by the framework via registration
|
|
25
|
+
* rather than by visible references (Obsidian lifecycle hooks, settings-tab `display`, etc.) are
|
|
26
|
+
* excluded via {@link LIFECYCLE_ALLOWLIST}, as are `override` and `static` members whose exposure is
|
|
27
|
+
* constrained by a base declaration. ECMAScript hard-private members (`#name`) are also excluded —
|
|
28
|
+
* they are already maximally private and cannot carry a visibility modifier. A declaration carrying
|
|
29
|
+
* a TSDoc (`/** … *\/`) documentation comment is likewise excluded — whether a top-level `export` or
|
|
30
|
+
* a class member, documenting it is a deliberate signal that it is part of the intended public API,
|
|
31
|
+
* regardless of where it currently happens to be referenced.
|
|
32
|
+
*
|
|
33
|
+
* A member referenced only from test files is reported with {@link OverExposureFinding.isForcedByTestOnly}
|
|
34
|
+
* set, surfacing members widened purely for testability — the canonical case for extracting logic
|
|
35
|
+
* into an independently testable component instead.
|
|
36
|
+
*
|
|
37
|
+
* Beyond reporting, passing `shouldFix` to {@link findOverExposure} / {@link analyzeOverExposure}
|
|
38
|
+
* rewrites the source in place: dropping the `export` keyword, or replacing/inserting a `private`
|
|
39
|
+
* or `protected` modifier. Each finding then carries {@link OverExposureFinding.wasFixed} /
|
|
40
|
+
* {@link OverExposureFinding.skipReason}. Changes that cannot be safely automated — those forced
|
|
41
|
+
* only by test references, decorated members, or an `export` shared with a still-exported sibling —
|
|
42
|
+
* are reported as skipped and left untouched.
|
|
43
|
+
*
|
|
44
|
+
* Additionally passing `shouldForce` (only meaningful together with `shouldFix`) tightens the
|
|
45
|
+
* declarations held wide purely by test references too — the production half of the canonical
|
|
46
|
+
* test-only migration: the member becomes `private` / the `export` is dropped, leaving only the
|
|
47
|
+
* test to switch to a cast-based access. Decorated members and exports shared with a still-exported
|
|
48
|
+
* sibling stay skipped even under `shouldForce`, because no edit can be applied safely.
|
|
49
|
+
*/
|
|
50
|
+
import type { CompilerOptions, LanguageService, LanguageServiceHost } from 'typescript';
|
|
51
|
+
/**
|
|
52
|
+
* Parameters for {@link analyzeOverExposure}.
|
|
53
|
+
*/
|
|
54
|
+
export interface AnalyzeOverExposureParams {
|
|
55
|
+
/**
|
|
56
|
+
The language service to query for references and types.
|
|
57
|
+
*/
|
|
58
|
+
readonly languageService: LanguageService;
|
|
59
|
+
/**
|
|
60
|
+
* Optional callback invoked once per analyzed source file, before that file is processed. The
|
|
61
|
+
* whole-program reference analysis is slow, so this lets callers report live progress instead of
|
|
62
|
+
* appearing to hang.
|
|
63
|
+
*/
|
|
64
|
+
readonly onProgress?: (progress: OverExposureProgress) => void;
|
|
65
|
+
/**
|
|
66
|
+
* When `true`, each fixable finding is tightened in place via {@link writeFile} (which must then
|
|
67
|
+
* be provided), and the returned findings carry {@link OverExposureFinding.wasFixed} /
|
|
68
|
+
* {@link OverExposureFinding.skipReason}. When `false` or omitted, the analysis only reports.
|
|
69
|
+
*
|
|
70
|
+
* @default `false`
|
|
71
|
+
*/
|
|
72
|
+
readonly shouldFix?: boolean | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* When `true` (only meaningful together with {@link shouldFix}), declarations held wide purely by
|
|
75
|
+
* test references are tightened too, instead of being skipped with a `test-only`
|
|
76
|
+
* {@link OverExposureFinding.skipReason}. Decorated members and exports shared with a
|
|
77
|
+
* still-exported sibling stay skipped regardless, because no edit can be applied safely.
|
|
78
|
+
*
|
|
79
|
+
* @default `false`
|
|
80
|
+
*/
|
|
81
|
+
readonly shouldForce?: boolean | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Absolute (canonical) path of the project's `src` folder. Only declarations in non-test files
|
|
84
|
+
* under this folder are analyzed; declarations elsewhere (test files, dependencies) are ignored
|
|
85
|
+
* but still counted as reference sites.
|
|
86
|
+
*/
|
|
87
|
+
readonly srcFolder: string;
|
|
88
|
+
/**
|
|
89
|
+
* Writes the tightened contents of a changed file back to disk. Required when {@link shouldFix}
|
|
90
|
+
* is `true`; ignored otherwise.
|
|
91
|
+
*
|
|
92
|
+
* @param path - Absolute path of the file to write (original casing, as stored in the program).
|
|
93
|
+
* @param content - The full new file contents.
|
|
94
|
+
*/
|
|
95
|
+
readonly writeFile?: (path: string, content: string) => void;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Parameters for {@link createLanguageServiceHost}.
|
|
99
|
+
*/
|
|
100
|
+
export interface CreateLanguageServiceHostParams {
|
|
101
|
+
/**
|
|
102
|
+
The compiler options.
|
|
103
|
+
*/
|
|
104
|
+
readonly compilerOptions: CompilerOptions;
|
|
105
|
+
/**
|
|
106
|
+
The files to include in the program.
|
|
107
|
+
*/
|
|
108
|
+
readonly fileNames: readonly string[];
|
|
109
|
+
/**
|
|
110
|
+
The file-system operations used to read sources.
|
|
111
|
+
*/
|
|
112
|
+
readonly fileSystem: OverExposureFileSystem;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Parameters for {@link createProjectLanguageService}.
|
|
116
|
+
*/
|
|
117
|
+
export interface CreateProjectLanguageServiceParams {
|
|
118
|
+
/**
|
|
119
|
+
Absolute path to the project's `tsconfig.json`.
|
|
120
|
+
*/
|
|
121
|
+
readonly tsConfigPath: string;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* The exposure level a declaration currently has.
|
|
125
|
+
*/
|
|
126
|
+
export type CurrentExposure = 'export' | 'protected' | 'public';
|
|
127
|
+
/**
|
|
128
|
+
* Parameters for {@link findOverExposure}.
|
|
129
|
+
*/
|
|
130
|
+
export interface FindOverExposureParams {
|
|
131
|
+
/**
|
|
132
|
+
* Optional callback invoked once per analyzed source file, for live progress reporting. Forwarded
|
|
133
|
+
* to {@link analyzeOverExposure}.
|
|
134
|
+
*/
|
|
135
|
+
readonly onProgress?: (progress: OverExposureProgress) => void;
|
|
136
|
+
/**
|
|
137
|
+
Absolute path to the project root (the folder containing `tsconfig.json` and `src`).
|
|
138
|
+
*/
|
|
139
|
+
readonly projectFolder: string;
|
|
140
|
+
/**
|
|
141
|
+
* When `true`, fixable findings are tightened in place on disk (the `export` keyword is dropped,
|
|
142
|
+
* or a `private` / `protected` modifier is inserted/replaced). When `false` or omitted, the
|
|
143
|
+
* project is only analyzed.
|
|
144
|
+
*
|
|
145
|
+
* @default `false`
|
|
146
|
+
*/
|
|
147
|
+
readonly shouldFix?: boolean | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* When `true` (only meaningful together with {@link shouldFix}), declarations held wide purely by
|
|
150
|
+
* test references are tightened too, instead of being skipped. Decorated members and exports
|
|
151
|
+
* shared with a still-exported sibling stay skipped regardless. Forwarded to
|
|
152
|
+
* {@link analyzeOverExposure}.
|
|
153
|
+
*
|
|
154
|
+
* @default `false`
|
|
155
|
+
*/
|
|
156
|
+
readonly shouldForce?: boolean | undefined;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Options for {@link formatOverExposureFindings}.
|
|
160
|
+
*/
|
|
161
|
+
export interface FormatOverExposureFindingsOptions {
|
|
162
|
+
/**
|
|
163
|
+
* When set, file paths in the report are rendered relative to this folder (typically the current
|
|
164
|
+
* working directory) instead of as absolute paths. Paths outside the folder stay absolute.
|
|
165
|
+
*/
|
|
166
|
+
readonly baseFolder?: string;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* The subset of file-system operations the language-service host needs. Injecting this (rather than
|
|
170
|
+
* always using `typescript`'s `sys`) lets tests drive the analyzer against in-memory sources with no
|
|
171
|
+
* real file-system access.
|
|
172
|
+
*/
|
|
173
|
+
export interface OverExposureFileSystem {
|
|
174
|
+
/**
|
|
175
|
+
* Checks whether a directory exists.
|
|
176
|
+
*
|
|
177
|
+
* @param path - Directory path.
|
|
178
|
+
* @returns `true` when the directory exists.
|
|
179
|
+
*/
|
|
180
|
+
directoryExists: (path: string) => boolean;
|
|
181
|
+
/**
|
|
182
|
+
* Checks whether a file exists.
|
|
183
|
+
*
|
|
184
|
+
* @param path - File path.
|
|
185
|
+
* @returns `true` when the file exists.
|
|
186
|
+
*/
|
|
187
|
+
fileExists: (path: string) => boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Resolves the directory that relative paths are resolved against.
|
|
190
|
+
*
|
|
191
|
+
* @returns The current working directory.
|
|
192
|
+
*/
|
|
193
|
+
getCurrentDirectory: () => string;
|
|
194
|
+
/**
|
|
195
|
+
* Lists the immediate subdirectories of a directory.
|
|
196
|
+
*
|
|
197
|
+
* @param path - Directory path.
|
|
198
|
+
* @returns The immediate subdirectory names.
|
|
199
|
+
*/
|
|
200
|
+
getDirectories: (path: string) => string[];
|
|
201
|
+
/**
|
|
202
|
+
* Lists the files under a directory, filtered by extension and include/exclude patterns.
|
|
203
|
+
*
|
|
204
|
+
* @param path - Root directory.
|
|
205
|
+
* @param extensions - Extensions to include.
|
|
206
|
+
* @param exclude - Patterns to exclude.
|
|
207
|
+
* @param include - Patterns to include.
|
|
208
|
+
* @param depth - Maximum recursion depth.
|
|
209
|
+
* @returns The matching file paths.
|
|
210
|
+
*/
|
|
211
|
+
readDirectory: (path: string, extensions?: readonly string[], exclude?: readonly string[], include?: readonly string[], depth?: number) => string[];
|
|
212
|
+
/**
|
|
213
|
+
* Reads a file as text.
|
|
214
|
+
*
|
|
215
|
+
* @param path - File path.
|
|
216
|
+
* @returns The file contents, or `undefined` when absent.
|
|
217
|
+
*/
|
|
218
|
+
readFile: (path: string) => string | undefined;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* A single over-exposed declaration.
|
|
222
|
+
*/
|
|
223
|
+
export interface OverExposureFinding {
|
|
224
|
+
/**
|
|
225
|
+
1-based column of the declaration's name.
|
|
226
|
+
*/
|
|
227
|
+
readonly column: number;
|
|
228
|
+
/**
|
|
229
|
+
The current exposure level.
|
|
230
|
+
*/
|
|
231
|
+
readonly currentExposure: CurrentExposure;
|
|
232
|
+
/**
|
|
233
|
+
Absolute path of the file declaring the symbol.
|
|
234
|
+
*/
|
|
235
|
+
readonly filePath: string;
|
|
236
|
+
/**
|
|
237
|
+
`true` when the declaration has no references at all (besides itself).
|
|
238
|
+
*/
|
|
239
|
+
readonly hasNoReferences: boolean;
|
|
240
|
+
/**
|
|
241
|
+
* `true` when the declaration would qualify for a tighter exposure if not for references coming
|
|
242
|
+
* exclusively from test files — i.e. it is exposed purely for testability.
|
|
243
|
+
*/
|
|
244
|
+
readonly isForcedByTestOnly: boolean;
|
|
245
|
+
/**
|
|
246
|
+
`true` for a class member, `false` for a top-level export.
|
|
247
|
+
*/
|
|
248
|
+
readonly isMember: boolean;
|
|
249
|
+
/**
|
|
250
|
+
1-based line of the declaration's name.
|
|
251
|
+
*/
|
|
252
|
+
readonly line: number;
|
|
253
|
+
/**
|
|
254
|
+
The declared name.
|
|
255
|
+
*/
|
|
256
|
+
readonly name: string;
|
|
257
|
+
/**
|
|
258
|
+
* In a fix run, why this finding was left untouched instead of tightened; `null` when it was
|
|
259
|
+
* fixed or when the analysis only reported (`shouldFix` off).
|
|
260
|
+
*/
|
|
261
|
+
readonly skipReason: null | OverExposureSkipReason;
|
|
262
|
+
/**
|
|
263
|
+
The exposure the declaration could be tightened to.
|
|
264
|
+
*/
|
|
265
|
+
readonly suggestedExposure: SuggestedExposure;
|
|
266
|
+
/**
|
|
267
|
+
`true` when a fix run tightened this declaration in place. Always `false` in a report run.
|
|
268
|
+
*/
|
|
269
|
+
readonly wasFixed: boolean;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Progress reported while analyzing a project, one event per analyzed source file.
|
|
273
|
+
*/
|
|
274
|
+
export interface OverExposureProgress {
|
|
275
|
+
/**
|
|
276
|
+
Number of source files fully analyzed before the current one (0-based).
|
|
277
|
+
*/
|
|
278
|
+
readonly analyzedFileCount: number;
|
|
279
|
+
/**
|
|
280
|
+
Absolute (canonical) path of the source file about to be analyzed.
|
|
281
|
+
*/
|
|
282
|
+
readonly currentFilePath: string;
|
|
283
|
+
/**
|
|
284
|
+
Total number of source files that will be analyzed.
|
|
285
|
+
*/
|
|
286
|
+
readonly totalFileCount: number;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Why a fix run left a finding untouched:
|
|
290
|
+
*
|
|
291
|
+
* - `decorated` — the member carries a decorator, so the modifier insertion point is ambiguous.
|
|
292
|
+
* - `shared-export` — the `export` keyword is shared with a still-exported sibling declarator.
|
|
293
|
+
* - `test-only` — the declaration is exposed purely for tests, so tightening would break the test.
|
|
294
|
+
*/
|
|
295
|
+
export type OverExposureSkipReason = 'decorated' | 'shared-export' | 'test-only';
|
|
296
|
+
/**
|
|
297
|
+
* The (tighter) exposure level a declaration could be reduced to.
|
|
298
|
+
*/
|
|
299
|
+
export type SuggestedExposure = 'file-local' | 'private' | 'protected';
|
|
300
|
+
/**
|
|
301
|
+
* Lifecycle and framework members invoked by Obsidian or a base class via registration rather than
|
|
302
|
+
* by references the language service can see. Tightening these would break the framework contract,
|
|
303
|
+
* so they are never reported.
|
|
304
|
+
*/
|
|
305
|
+
export declare const LIFECYCLE_ALLOWLIST: ReadonlySet<string>;
|
|
306
|
+
/**
|
|
307
|
+
* Analyzes a project (already loaded into a language service) for over-exposed declarations, and —
|
|
308
|
+
* when {@link AnalyzeOverExposureParams.shouldFix} is set — tightens every fixable finding in place
|
|
309
|
+
* via {@link AnalyzeOverExposureParams.writeFile}. Findings that cannot be safely automated (exposed
|
|
310
|
+
* only for tests, decorated, or sharing an `export` keyword with a still-exported sibling) carry a
|
|
311
|
+
* {@link OverExposureFinding.skipReason} and are left untouched — unless
|
|
312
|
+
* {@link AnalyzeOverExposureParams.shouldForce} is set, which additionally tightens the test-only
|
|
313
|
+
* findings (decorated and shared-export ones still stay skipped).
|
|
314
|
+
*
|
|
315
|
+
* @param params - The {@link AnalyzeOverExposureParams}.
|
|
316
|
+
* @returns The over-exposed declarations, in discovery order.
|
|
317
|
+
*/
|
|
318
|
+
export declare function analyzeOverExposure(params: AnalyzeOverExposureParams): OverExposureFinding[];
|
|
319
|
+
/**
|
|
320
|
+
* Builds a {@link LanguageServiceHost} backed by an explicit file list and file system.
|
|
321
|
+
*
|
|
322
|
+
* @param params - The {@link CreateLanguageServiceHostParams}.
|
|
323
|
+
* @returns The language-service host.
|
|
324
|
+
*/
|
|
325
|
+
export declare function createLanguageServiceHost(params: CreateLanguageServiceHostParams): LanguageServiceHost;
|
|
326
|
+
/**
|
|
327
|
+
* Builds a language service over every file in a project's `tsconfig.json`.
|
|
328
|
+
*
|
|
329
|
+
* @param params - The {@link CreateProjectLanguageServiceParams}.
|
|
330
|
+
* @returns A language service ready for {@link analyzeOverExposure}.
|
|
331
|
+
*/
|
|
332
|
+
export declare function createProjectLanguageService(params: CreateProjectLanguageServiceParams): LanguageService;
|
|
333
|
+
/**
|
|
334
|
+
* Finds over-exposed declarations in a project on disk. When
|
|
335
|
+
* {@link FindOverExposureParams.shouldFix} is set, each fixable finding is also tightened in place
|
|
336
|
+
* (rewriting the affected source files via `typescript`'s `sys.writeFile`).
|
|
337
|
+
*
|
|
338
|
+
* @param params - The {@link FindOverExposureParams}.
|
|
339
|
+
* @returns The over-exposed declarations.
|
|
340
|
+
*/
|
|
341
|
+
export declare function findOverExposure(params: FindOverExposureParams): OverExposureFinding[];
|
|
342
|
+
/**
|
|
343
|
+
* Formats over-exposure findings as a human-readable report, using the grouped layout of ESLint's
|
|
344
|
+
* `stylish` formatter. Findings are grouped by file and sorted by line: each file is rendered as a
|
|
345
|
+
* `path` header line, followed by one indented ` line:column change -- reason` row per finding (the
|
|
346
|
+
* `line:column` is right-padded so the rows align within a file). Terminals such as VS Code render
|
|
347
|
+
* each indented `line:column` as a clickable link — resolved against the file header above it — that
|
|
348
|
+
* jumps straight to the declaration. File groups are separated by a blank line. In a fix run (findings
|
|
349
|
+
* carrying {@link OverExposureFinding.wasFixed} / {@link OverExposureFinding.skipReason}) each change
|
|
350
|
+
* row is suffixed with `[fixed]` or `[skipped: …]`, and the trailing summary appends the fixed/skipped
|
|
351
|
+
* counts.
|
|
352
|
+
*
|
|
353
|
+
* @param findings - The findings to format.
|
|
354
|
+
* @param options - The {@link FormatOverExposureFindingsOptions}.
|
|
355
|
+
* @returns The report text. Empty-finding input yields a single "no findings" line.
|
|
356
|
+
*/
|
|
357
|
+
export declare function formatOverExposureFindings(findings: readonly OverExposureFinding[], options?: FormatOverExposureFindingsOptions): string;
|