@hailstails/hone 2.0.0-pre.2 → 2.0.0-pre.4
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/ADOPTING.md +7 -7
- package/CHANGELOG.md +76 -0
- package/MIGRATING.md +15 -6
- package/README.md +12 -13
- package/chunks/chunk-3CWFUD5B.js +38 -0
- package/chunks/chunk-5AKHEW6V.js +15 -0
- package/chunks/chunk-75XWZYNN.js +64 -0
- package/chunks/chunk-7FVSZ2VL.js +1304 -0
- package/chunks/chunk-A3RL4O5V.js +146 -0
- package/chunks/chunk-BIDD2YWP.js +398 -0
- package/chunks/{chunk-GNOMK7CR.js → chunk-BKQ3K766.js} +489 -52
- package/chunks/{chunk-NRIQD3PI.js → chunk-BRANVR7K.js} +3 -5
- package/chunks/chunk-COQMPHWZ.js +37 -0
- package/chunks/{chunk-L7BGRC6D.js → chunk-CXM5KBZX.js} +1 -1
- package/chunks/chunk-D6645WPB.js +6 -0
- package/chunks/chunk-DJMF6JIM.js +42 -0
- package/chunks/{chunk-OKLYWD2Z.js → chunk-E4D5WDRX.js} +27 -20
- package/chunks/chunk-EBX57Z3V.js +8 -0
- package/chunks/chunk-FHVNKG5Q.js +19 -0
- package/chunks/chunk-FPIP7JEC.js +191 -0
- package/chunks/{chunk-QP5TLOBY.js → chunk-HVZVKZPW.js} +12 -9
- package/chunks/chunk-LD766VWU.js +57 -0
- package/chunks/chunk-LEFM7OPS.js +41 -0
- package/chunks/chunk-LNMDMRGQ.js +51 -0
- package/chunks/{chunk-RGSHTPLA.js → chunk-MBEDAFVC.js} +3 -11
- package/chunks/chunk-OO5KV7KN.js +17 -0
- package/chunks/{chunk-ASUN4AVC.js → chunk-PVSC4SE3.js} +71 -5
- package/chunks/chunk-SKDQ3QJD.js +75 -0
- package/chunks/chunk-W5OIAUDW.js +18 -0
- package/chunks/chunk-X73RZUPO.js +63 -0
- package/chunks/chunk-XE2KKWYH.js +45 -0
- package/chunks/chunk-YGMO5Z6U.js +432 -0
- package/chunks/chunk-YONPKP3C.js +15 -0
- package/docs/adding-a-discipline-or-mechanism.md +1 -1
- package/docs/extending.md +7 -388
- package/package.json +7 -6
- package/rules/README.md +2 -2
- package/rules/typescript/checks.md +236 -18
- package/rules/typescript/symptoms/ambient-randomness/random-call.md +10 -0
- package/rules/typescript/symptoms/answer-set-in-a-hook/hook-answer.md +10 -0
- package/rules/typescript/symptoms/assertion-outside-a-test/assertion-site.md +10 -0
- package/rules/typescript/symptoms/assertion-outside-a-test.md +25 -0
- package/rules/typescript/symptoms/built-unit-called-in-place/call-of-a-call.md +10 -0
- package/rules/typescript/symptoms/built-unit-called-in-place.md +25 -0
- package/rules/typescript/symptoms/code-or-prose-read-as-text/raw-read.md +10 -0
- package/rules/typescript/symptoms/code-or-prose-read-as-text.md +31 -0
- package/rules/typescript/symptoms/computed-value-in-a-test/test-body.md +1 -1
- package/rules/typescript/symptoms/double-with-a-body/logic-in-a-passed-function.md +1 -1
- package/rules/typescript/symptoms/double-with-a-body/stub-implementation.md +2 -2
- package/rules/typescript/symptoms/export-from-a-test-file/test-file-export.md +10 -0
- package/rules/typescript/symptoms/export-from-a-test-file.md +33 -0
- package/rules/typescript/symptoms/failure-shaped-as-success/empty-catch.md +10 -0
- package/rules/typescript/symptoms/floating-version/version-selector.md +10 -0
- package/rules/typescript/symptoms/inherited-environment-in-a-subprocess/git-spawn-environment.md +1 -1
- package/rules/typescript/symptoms/many-spellings-of-one-concept/test-call-aliases.md +10 -0
- package/rules/typescript/symptoms/many-spellings-of-one-concept.md +3 -2
- package/rules/typescript/symptoms/module-or-global-patched/module-mock-call.md +4 -4
- package/rules/typescript/symptoms/no-lock-file/committed-lock-file.md +12 -0
- package/rules/typescript/symptoms/process-global-used-in-place/debugger-statement.md +10 -0
- package/rules/typescript/symptoms/process-global-used-in-place/direct-global-use.md +14 -0
- package/rules/typescript/symptoms/process-global-used-in-place.md +1 -1
- package/rules/typescript/symptoms/prose-in-code/comment-prose.md +12 -0
- package/rules/typescript/symptoms/test-switched-off/skipped-tests.md +3 -6
- package/rules/typescript/symptoms/test-switched-off.md +1 -1
- package/rules/typescript/symptoms/throw-between-our-units/throw-statement.md +10 -0
- package/rules/typescript/symptoms/throw-or-catch-in-a-test/throw-statement.md +1 -1
- package/rules/typescript/symptoms/tool-fetched-at-run-time/fetch-command.md +10 -0
- package/rules/typescript/symptoms/type-declared-in-a-test/test-type-declaration.md +10 -0
- package/rules/typescript/symptoms/type-declared-in-a-test.md +33 -0
- package/rules/typescript/symptoms/unit-without-a-running-test/companion-test-file.md +2 -2
- package/rules/typescript/symptoms/wide-input/unread-parameter.md +10 -0
- package/rules/typescript/symptoms/wide-input.md +3 -2
- package/rules/typescript/symptoms.md +183 -121
- package/src/application/conformance/conformance-testing-types.d.ts +13 -16
- package/src/domain/language-layer/authored-item-types.d.ts +50 -0
- package/src/domain/language-layer/catalogue-name.d.ts +5 -0
- package/src/domain/language-layer/check-address-text.d.ts +12 -0
- package/src/domain/rule-set/authored-rule-set-types.d.ts +31 -32
- package/src/domain/rule-set/clause-address-types.d.ts +4 -3
- package/src/domain/rule-set/rule-set-name-of.d.ts +10 -0
- package/src/domain/runner/check-binding.d.ts +18 -0
- package/src/domain/runner/check-observations.d.ts +39 -0
- package/src/domain/runner/conformance-types.d.ts +8 -2
- package/src/domain/settings/test-files.d.ts +7 -0
- package/src/eslint-plugin.js +16 -12
- package/src/hone.js +10493 -10410
- package/src/infrastructure/engines/eslint/authored-class-or-this/static-members-only/piece.json +0 -6
- package/src/infrastructure/engines/eslint/long-function/function-length/piece.json +0 -6
- package/src/infrastructure/engines/eslint/runner/pieces/eslint-piece-settings-types.d.ts +2 -0
- package/src/infrastructure/engines/eslint/runner/runner.js +953 -1189
- package/src/infrastructure/engines/eslint/test-switched-off/focused-tests/README.md +0 -3
- package/src/infrastructure/engines/eslint/test-switched-off/focused-tests/eslint-plugin.js +33 -21
- package/src/infrastructure/engines/eslint/test-switched-off/skipped-tests/piece.json +11 -4
- package/src/infrastructure/engines/eslint/test-switched-off/skipped-tests/skipped-tests.examples.json +28 -0
- package/src/infrastructure/engines/eslint/untyped-value/implicit-any-let/piece.json +0 -2
- package/src/infrastructure/engines/eslint/wide-input/unread-parameter/eslint-plugin.js +94 -0
- package/src/infrastructure/engines/eslint/wide-input/unread-parameter/piece.json +11 -0
- package/src/infrastructure/engines/eslint/wide-input/unread-parameter/unread-parameter.examples.json +48 -0
- package/src/infrastructure/engines/walker/ambient-randomness/random-call/ambient-randomness.js +109 -0
- package/src/infrastructure/engines/walker/ambient-randomness/random-call/piece.json +9 -0
- package/src/infrastructure/engines/walker/ambient-randomness/random-call/random-call.examples.json +48 -0
- package/src/infrastructure/engines/walker/answer-set-in-a-hook/hook-answer/hook-answer.examples.json +42 -0
- package/src/infrastructure/engines/walker/answer-set-in-a-hook/hook-answer/hook-answers.js +72 -0
- package/src/infrastructure/engines/walker/answer-set-in-a-hook/hook-answer/piece.json +9 -0
- package/src/infrastructure/engines/walker/assertion-outside-a-test/assertion-site/assertion-site.examples.json +30 -0
- package/src/infrastructure/engines/walker/assertion-outside-a-test/assertion-site/assertion-site.js +123 -0
- package/src/infrastructure/engines/walker/assertion-outside-a-test/assertion-site/piece.json +9 -0
- package/src/infrastructure/engines/walker/authored-class-or-this/class-keyword/class-syntax.js +3 -3
- package/src/infrastructure/engines/walker/boolean-in-a-signature/boolean-annotation/boolean-signatures.js +7 -5
- package/src/infrastructure/engines/walker/branch-in-a-test/test-body/test-body-logic.js +213 -126
- package/src/infrastructure/engines/walker/built-unit-called-in-place/call-of-a-call/call-of-a-call.examples.json +24 -0
- package/src/infrastructure/engines/walker/built-unit-called-in-place/call-of-a-call/call-of-a-call.js +34 -0
- package/src/infrastructure/engines/walker/built-unit-called-in-place/call-of-a-call/piece.json +9 -0
- package/src/infrastructure/engines/walker/claimed-type/cast-to-any/any-cast.js +6 -4
- package/src/infrastructure/engines/walker/claimed-type/unlisted-cast-site/cast-expressions.js +6 -4
- package/src/infrastructure/engines/walker/code-or-prose-read-as-text/raw-read/piece.json +9 -0
- package/src/infrastructure/engines/walker/code-or-prose-read-as-text/raw-read/raw-read.examples.json +30 -0
- package/src/infrastructure/engines/walker/code-or-prose-read-as-text/raw-read/raw-read.js +166 -0
- package/src/infrastructure/engines/walker/computed-value-in-a-test/test-body/piece.json +0 -10
- package/src/infrastructure/engines/walker/date-used-directly/clock-sources/clock-sources.js +4 -4
- package/src/infrastructure/engines/walker/default-on-a-closed-union/default-arm/switch-defaults.js +8 -6
- package/src/infrastructure/engines/walker/double-with-a-body/logic-in-a-passed-function/piece.json +0 -10
- package/src/infrastructure/engines/walker/double-with-a-body/stub-implementation/dependency-isolation.js +9 -14
- package/src/infrastructure/engines/walker/drawer-path/drawer-names/categorical-paths.js +4 -4
- package/src/infrastructure/engines/walker/export-from-a-test-file/test-file-export/piece.json +9 -0
- package/src/infrastructure/engines/walker/export-from-a-test-file/test-file-export/test-file-export.examples.json +30 -0
- package/src/infrastructure/engines/walker/export-from-a-test-file/test-file-export/test-file-export.js +31 -0
- package/src/infrastructure/engines/walker/failure-shaped-as-success/empty-catch/empty-catch.examples.json +18 -0
- package/src/infrastructure/engines/walker/failure-shaped-as-success/empty-catch/empty-catch.js +32 -0
- package/src/infrastructure/engines/walker/failure-shaped-as-success/empty-catch/piece.json +9 -0
- package/src/infrastructure/engines/walker/floating-version/version-selector/piece.json +9 -0
- package/src/infrastructure/engines/walker/floating-version/version-selector/version-selector.examples.json +54 -0
- package/src/infrastructure/engines/walker/floating-version/version-selector/version-selector.js +75 -0
- package/src/infrastructure/engines/walker/inherited-environment-in-a-subprocess/git-spawn-environment/hermetic-git-spawns.js +8 -17
- package/src/infrastructure/engines/walker/loop-keyword/loop-statement/loops.js +8 -6
- package/src/infrastructure/engines/walker/many-spellings-of-one-concept/test-call-aliases/piece.json +9 -0
- package/src/infrastructure/engines/walker/many-spellings-of-one-concept/test-call-aliases/test-call-aliases.examples.json +36 -0
- package/src/infrastructure/engines/walker/many-spellings-of-one-concept/test-call-aliases/test-call-aliases.js +67 -0
- package/src/infrastructure/engines/walker/module-or-global-patched/module-mock-call/module-mock-call.examples.json +34 -0
- package/src/infrastructure/engines/walker/module-or-global-patched/module-mock-call/module-mocking.js +64 -16
- package/src/infrastructure/engines/walker/module-or-global-patched/module-mock-call/piece.json +5 -1
- package/src/infrastructure/engines/walker/no-lock-file/committed-lock-file/committed-lock-file.examples.json +24 -0
- package/src/infrastructure/engines/walker/no-lock-file/committed-lock-file/committed-lock-file.js +41 -0
- package/src/infrastructure/engines/walker/no-lock-file/committed-lock-file/piece.json +9 -0
- package/src/infrastructure/engines/walker/outside-import-past-a-boundary/import-or-require/import-boundaries.js +18 -16
- package/src/infrastructure/engines/walker/outside-import-past-a-boundary/import-or-require/piece.json +1 -1
- package/src/infrastructure/engines/walker/process-global-used-in-place/debugger-statement/debugger-statement.examples.json +18 -0
- package/src/infrastructure/engines/walker/process-global-used-in-place/debugger-statement/debugger-statement.js +17 -0
- package/src/infrastructure/engines/walker/process-global-used-in-place/debugger-statement/piece.json +9 -0
- package/src/infrastructure/engines/walker/process-global-used-in-place/direct-global-use/direct-global-use.examples.json +63 -0
- package/src/infrastructure/engines/walker/process-global-used-in-place/direct-global-use/piece.json +13 -0
- package/src/infrastructure/engines/walker/process-global-used-in-place/direct-global-use/process-global-used-in-place.js +126 -0
- package/src/infrastructure/engines/walker/prose-in-code/comment-prose/comment-prose.examples.json +42 -0
- package/src/infrastructure/engines/walker/prose-in-code/comment-prose/piece.json +16 -0
- package/src/infrastructure/engines/walker/prose-in-code/comment-prose/prose-in-code.js +90 -0
- package/src/infrastructure/engines/walker/rebinding/test-body/piece.json +0 -10
- package/src/infrastructure/engines/walker/runner/pieces/walker-piece.d.ts +7 -5
- package/src/infrastructure/engines/walker/runner/runner.js +266 -77
- package/src/infrastructure/engines/walker/runner/toolchain/typescript-parse.d.ts +3 -0
- package/src/infrastructure/engines/walker/shorthand-name/identifier-names/identifier-names.js +12 -7
- package/src/infrastructure/engines/walker/strictness-weakened/exact-optional-property-types/piece.json +0 -10
- package/src/infrastructure/engines/walker/strictness-weakened/no-fallthrough-cases-in-switch/piece.json +0 -10
- package/src/infrastructure/engines/walker/strictness-weakened/no-implicit-override/piece.json +0 -10
- package/src/infrastructure/engines/walker/strictness-weakened/no-property-access-from-index-signature/piece.json +0 -10
- package/src/infrastructure/engines/walker/strictness-weakened/no-unchecked-indexed-access/piece.json +0 -10
- package/src/infrastructure/engines/walker/strictness-weakened/strict/compiler-overrides.js +30 -52
- package/src/infrastructure/engines/walker/strictness-weakened/use-unknown-in-catch-variables/piece.json +0 -10
- package/src/infrastructure/engines/walker/text-past-its-reader/test-body/piece.json +0 -10
- package/src/infrastructure/engines/walker/throw-between-our-units/throw-statement/piece.json +9 -0
- package/src/infrastructure/engines/walker/throw-between-our-units/throw-statement/throw-statement.examples.json +36 -0
- package/src/infrastructure/engines/walker/throw-between-our-units/throw-statement/throws-in-production.js +12 -0
- package/src/infrastructure/engines/walker/throw-or-catch-in-a-test/throw-statement/throw-statement.examples.json +6 -6
- package/src/infrastructure/engines/walker/throw-or-catch-in-a-test/throw-statement/throws-in-tests.js +5 -44
- package/src/infrastructure/engines/walker/throw-or-catch-in-a-test/try-block/piece.json +0 -10
- package/src/infrastructure/engines/walker/tool-fetched-at-run-time/fetch-command/fetch-command.examples.json +42 -0
- package/src/infrastructure/engines/walker/tool-fetched-at-run-time/fetch-command/fetch-command.js +152 -0
- package/src/infrastructure/engines/walker/tool-fetched-at-run-time/fetch-command/piece.json +9 -0
- package/src/infrastructure/engines/walker/type-declared-in-a-test/test-type-declaration/piece.json +9 -0
- package/src/infrastructure/engines/walker/type-declared-in-a-test/test-type-declaration/test-type-declaration.examples.json +24 -0
- package/src/infrastructure/engines/walker/type-declared-in-a-test/test-type-declaration/test-type-declaration.js +27 -0
- package/src/infrastructure/engines/walker/type-derived-from-code/factory-return-types/factory-return-types.js +8 -6
- package/src/infrastructure/engines/walker/unit-without-a-running-test/companion-test-file/export-test-sibling.js +16 -10
- package/src/infrastructure/engines/walker/untracked-escape/directive-pointers/comments-directives.js +18 -64
- package/src/infrastructure/engines/walker/write-into-a-parameter/parameter-mutation/parameter-mutation.js +7 -5
- package/src/rule-set.d.ts +2 -1
- package/src/testing.d.ts +2 -4
- package/src/testing.js +104 -317
- package/src/{audit.d.ts → walker.d.ts} +13 -8
- package/src/walker.js +28 -0
- package/chunks/chunk-5HRMJ4O2.js +0 -608
- package/chunks/chunk-IX2VZTBO.js +0 -887
- package/chunks/chunk-K2W3D3NB.js +0 -17
- package/chunks/chunk-M6SOGWT7.js +0 -82
- package/chunks/chunk-MWLBA4B3.js +0 -849
- package/chunks/chunk-R75QELTA.js +0 -481
- package/chunks/chunk-RANAKCTW.js +0 -31
- package/chunks/chunk-TNY2PASL.js +0 -38
- package/chunks/chunk-UJONWHA4.js +0 -22
- package/docs/output-contract.md +0 -1155
- package/src/audit.js +0 -18
- package/src/domain/runner/runner-module-types.d.ts +0 -15
|
@@ -1,49 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createDefaultJsoncParsePort
|
|
3
|
+
} from "../../../../../../chunks/chunk-DJMF6JIM.js";
|
|
1
4
|
import {
|
|
2
5
|
editionOf
|
|
3
6
|
} from "../../../../../../chunks/chunk-RFR3ITBS.js";
|
|
4
7
|
import {
|
|
5
8
|
folderScope
|
|
6
|
-
} from "../../../../../../chunks/chunk-
|
|
9
|
+
} from "../../../../../../chunks/chunk-COQMPHWZ.js";
|
|
7
10
|
import {
|
|
8
11
|
editionReaches
|
|
9
12
|
} from "../../../../../../chunks/chunk-RANIXNWY.js";
|
|
10
13
|
import "../../../../../../chunks/chunk-DGOLOS5A.js";
|
|
11
14
|
|
|
12
|
-
// src/infrastructure/engines/walker/runner/pieces/jsonc-parse.ts
|
|
13
|
-
import { parse } from "jsonc-parser";
|
|
14
|
-
var createJsoncParsePort = (options) => ({
|
|
15
|
-
parse: (request) => {
|
|
16
|
-
try {
|
|
17
|
-
const providerParse = options.parseProvider({ source: request.source });
|
|
18
|
-
const firstDiagnostic = providerParse.errors[0];
|
|
19
|
-
if (firstDiagnostic !== void 0) {
|
|
20
|
-
return {
|
|
21
|
-
outcome: "failed",
|
|
22
|
-
error: {
|
|
23
|
-
detail: `JSONC parse error ${firstDiagnostic.error} at offset ${firstDiagnostic.offset} (length ${firstDiagnostic.length})`
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
return { outcome: "ok", value: providerParse.value };
|
|
28
|
-
} catch (thrown) {
|
|
29
|
-
return {
|
|
30
|
-
outcome: "failed",
|
|
31
|
-
error: { detail: thrown instanceof Error ? thrown.message : String(thrown) }
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
var defaultProviderCallOf = (options) => (request) => {
|
|
37
|
-
const errors = [];
|
|
38
|
-
const parsedValue = parse(request.source, errors, {
|
|
39
|
-
allowTrailingComma: options.trailingCommas === "allowed"
|
|
40
|
-
});
|
|
41
|
-
return { value: parsedValue, errors };
|
|
42
|
-
};
|
|
43
|
-
var createDefaultJsoncParsePort = (options) => createJsoncParsePort({
|
|
44
|
-
parseProvider: defaultProviderCallOf(options)
|
|
45
|
-
});
|
|
46
|
-
|
|
47
15
|
// src/infrastructure/engines/walker/strictness-weakened/strict/typescript-compiler-options.ts
|
|
48
16
|
var FILE_LIST_DIAGNOSTICS = [18002, 18003];
|
|
49
17
|
var STRICT_FAMILY = ["strict", "useUnknownInCatchVariables"];
|
|
@@ -189,16 +157,28 @@ var RESOLVING_EDITION = editionOf("2");
|
|
|
189
157
|
var IMPLIED_BY_STRICT = ["useUnknownInCatchVariables"];
|
|
190
158
|
var FILE_ANCHOR = { line: 1, column: 0 };
|
|
191
159
|
var STRICT_FLAGS = [
|
|
192
|
-
{
|
|
193
|
-
{
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
160
|
+
{ check: "strictness-weakened#strict", option: "strict" },
|
|
161
|
+
{
|
|
162
|
+
check: "strictness-weakened#no-unchecked-indexed-access",
|
|
163
|
+
option: "noUncheckedIndexedAccess"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
check: "strictness-weakened#exact-optional-property-types",
|
|
167
|
+
option: "exactOptionalPropertyTypes"
|
|
168
|
+
},
|
|
169
|
+
{ check: "strictness-weakened#no-implicit-override", option: "noImplicitOverride" },
|
|
170
|
+
{
|
|
171
|
+
check: "strictness-weakened#no-fallthrough-cases-in-switch",
|
|
172
|
+
option: "noFallthroughCasesInSwitch"
|
|
173
|
+
},
|
|
197
174
|
{
|
|
198
|
-
|
|
175
|
+
check: "strictness-weakened#no-property-access-from-index-signature",
|
|
199
176
|
option: "noPropertyAccessFromIndexSignature"
|
|
200
177
|
},
|
|
201
|
-
{
|
|
178
|
+
{
|
|
179
|
+
check: "strictness-weakened#use-unknown-in-catch-variables",
|
|
180
|
+
option: "useUnknownInCatchVariables"
|
|
181
|
+
}
|
|
202
182
|
];
|
|
203
183
|
var configEligibility = (request) => {
|
|
204
184
|
if (request.file.split("/").at(-1) !== "tsconfig.json") return "excluded";
|
|
@@ -206,12 +186,10 @@ var configEligibility = (request) => {
|
|
|
206
186
|
return "eligible";
|
|
207
187
|
};
|
|
208
188
|
var selectedFlagsOf = (request) => STRICT_FLAGS.flatMap(
|
|
209
|
-
(flag) => request.
|
|
210
|
-
|
|
211
|
-
).map((clause) => ({
|
|
212
|
-
address: clause.address,
|
|
189
|
+
(flag) => request.bindings.filter((binding) => binding.address === flag.check).map((binding) => ({
|
|
190
|
+
address: binding.address,
|
|
213
191
|
option: flag.option,
|
|
214
|
-
judges: editionReaches({ edition:
|
|
192
|
+
judges: editionReaches({ edition: binding.edition, introducedIn: RESOLVING_EDITION }) === "reached" ? "resolved-options" : "own-options"
|
|
215
193
|
}))
|
|
216
194
|
);
|
|
217
195
|
var unparseable = (request) => ({
|
|
@@ -272,7 +250,7 @@ var judgedSnippet = (request) => {
|
|
|
272
250
|
}
|
|
273
251
|
};
|
|
274
252
|
var presenceHit = (request) => ({
|
|
275
|
-
|
|
253
|
+
check: request.flag.address,
|
|
276
254
|
anchor: FILE_ANCHOR,
|
|
277
255
|
snippet: `compilerOptions.${request.flag.option} = ${JSON.stringify(request.value)}`
|
|
278
256
|
});
|
|
@@ -286,12 +264,12 @@ var hitsOf = (request) => {
|
|
|
286
264
|
if (own !== void 0) return [presenceHit({ flag, value: own[1] })];
|
|
287
265
|
if (flag.judges === "own-options" || resolved === void 0) return [];
|
|
288
266
|
const snippet = judgedSnippet({ config: request.config, resolved, option: flag.option });
|
|
289
|
-
return snippet === void 0 ? [] : [{
|
|
267
|
+
return snippet === void 0 ? [] : [{ check: flag.address, anchor: FILE_ANCHOR, snippet }];
|
|
290
268
|
});
|
|
291
269
|
};
|
|
292
270
|
var createCompilerOverridesCheck = (options) => ({
|
|
293
|
-
prepare: ({
|
|
294
|
-
const flags = selectedFlagsOf({
|
|
271
|
+
prepare: ({ bindings, repository, syntaxApi }) => {
|
|
272
|
+
const flags = selectedFlagsOf({ bindings });
|
|
295
273
|
const resolution = options.resolutionOf({ syntaxApi, disk: repository.disk });
|
|
296
274
|
return {
|
|
297
275
|
outcome: "ok",
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"flag": [
|
|
3
|
+
{
|
|
4
|
+
"name": "throws in production",
|
|
5
|
+
"fileName": "src/order.ts",
|
|
6
|
+
"source": "throw new Error('unavailable');",
|
|
7
|
+
"expectedLines": [1]
|
|
8
|
+
}
|
|
9
|
+
],
|
|
10
|
+
"allow": [
|
|
11
|
+
{
|
|
12
|
+
"name": "returns a failure value",
|
|
13
|
+
"fileName": "src/order.ts",
|
|
14
|
+
"source": "export const run = () => ({ outcome: 'failed', error: 'unavailable' });",
|
|
15
|
+
"expectedLines": []
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "test throw is already checked",
|
|
19
|
+
"fileName": "src/order.test.ts",
|
|
20
|
+
"source": "throw new Error('test failure');",
|
|
21
|
+
"expectedLines": []
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "spec files are not production",
|
|
25
|
+
"fileName": "src/order.spec.ts",
|
|
26
|
+
"source": "throw new Error('test failure');",
|
|
27
|
+
"expectedLines": []
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "callee body is outside the syntax check",
|
|
31
|
+
"fileName": "src/order.ts",
|
|
32
|
+
"source": "externalLookup();",
|
|
33
|
+
"expectedLines": []
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
throwStatementCheck
|
|
3
|
+
} from "../../../../../../chunks/chunk-XE2KKWYH.js";
|
|
4
|
+
import "../../../../../../chunks/chunk-5AKHEW6V.js";
|
|
5
|
+
import "../../../../../../chunks/chunk-COQMPHWZ.js";
|
|
6
|
+
import "../../../../../../chunks/chunk-DGOLOS5A.js";
|
|
7
|
+
|
|
8
|
+
// src/infrastructure/engines/walker/throw-between-our-units/throw-statement/throws-in-production.ts
|
|
9
|
+
var check = throwStatementCheck("production");
|
|
10
|
+
export {
|
|
11
|
+
check
|
|
12
|
+
};
|
|
@@ -11,6 +11,12 @@
|
|
|
11
11
|
"fileName": "src/view.test.tsx",
|
|
12
12
|
"source": "const a = 1;\nthrow new Error(\"bad\");\n",
|
|
13
13
|
"expectedLines": [2]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "throw in a spec file",
|
|
17
|
+
"fileName": "src/load.spec.ts",
|
|
18
|
+
"source": "throw new Error(\"bad\");\n",
|
|
19
|
+
"expectedLines": [1]
|
|
14
20
|
}
|
|
15
21
|
],
|
|
16
22
|
"allow": [
|
|
@@ -25,12 +31,6 @@
|
|
|
25
31
|
"fileName": "src/load.ts",
|
|
26
32
|
"source": "export const load = (): never => {\n throw new Error(\"failed\");\n};\n",
|
|
27
33
|
"expectedLines": []
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"name": "spec files are not read",
|
|
31
|
-
"fileName": "src/load.spec.ts",
|
|
32
|
-
"source": "throw new Error(\"bad\");\n",
|
|
33
|
-
"expectedLines": []
|
|
34
34
|
}
|
|
35
35
|
]
|
|
36
36
|
}
|
|
@@ -1,51 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../../../../../../chunks/chunk-
|
|
2
|
+
throwStatementCheck
|
|
3
|
+
} from "../../../../../../chunks/chunk-XE2KKWYH.js";
|
|
4
|
+
import "../../../../../../chunks/chunk-5AKHEW6V.js";
|
|
5
|
+
import "../../../../../../chunks/chunk-COQMPHWZ.js";
|
|
4
6
|
import "../../../../../../chunks/chunk-DGOLOS5A.js";
|
|
5
7
|
|
|
6
8
|
// src/infrastructure/engines/walker/throw-or-catch-in-a-test/throw-statement/throws-in-tests.ts
|
|
7
|
-
var
|
|
8
|
-
if (folderScope({ file: request.file }) === "generated") return "skipped";
|
|
9
|
-
return request.file.endsWith(".test.ts") || request.file.endsWith(".test.tsx") ? "eligible" : "skipped";
|
|
10
|
-
};
|
|
11
|
-
var snippetAt = (request) => {
|
|
12
|
-
const snippet = request.source.slice(request.position, request.position + 80).replace(/\n/g, " ");
|
|
13
|
-
return snippet.length === 80 ? `${snippet}\u2026` : snippet;
|
|
14
|
-
};
|
|
15
|
-
var check = {
|
|
16
|
-
prepare: ({ clauses, syntaxApi }) => ({
|
|
17
|
-
outcome: "ok",
|
|
18
|
-
value: {
|
|
19
|
-
prepareFile: ({ file }) => {
|
|
20
|
-
if (testFileEligibility({ file }) === "skipped") {
|
|
21
|
-
return { outcome: "ok", value: { kind: "skipped" } };
|
|
22
|
-
}
|
|
23
|
-
return {
|
|
24
|
-
outcome: "ok",
|
|
25
|
-
value: {
|
|
26
|
-
kind: "syntax",
|
|
27
|
-
begin: ({ sourceFile, anchorAt }) => {
|
|
28
|
-
const hits = [];
|
|
29
|
-
return {
|
|
30
|
-
enter: ({ node }) => {
|
|
31
|
-
if (!syntaxApi.isThrowStatement(node)) return;
|
|
32
|
-
const position = node.getStart(sourceFile);
|
|
33
|
-
const anchor = anchorAt({ position });
|
|
34
|
-
const snippet = snippetAt({ source: sourceFile.text, position });
|
|
35
|
-
hits.push(
|
|
36
|
-
...clauses.map((clause) => ({ clause: clause.address, anchor, snippet }))
|
|
37
|
-
);
|
|
38
|
-
},
|
|
39
|
-
finish: () => hits
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
},
|
|
45
|
-
finish: () => ({ outcome: "ok", value: [] })
|
|
46
|
-
}
|
|
47
|
-
})
|
|
48
|
-
};
|
|
9
|
+
var check = throwStatementCheck("test");
|
|
49
10
|
export {
|
|
50
11
|
check
|
|
51
12
|
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"flag": [
|
|
3
|
+
{
|
|
4
|
+
"name": "fetch in a package script",
|
|
5
|
+
"fileName": "package.json",
|
|
6
|
+
"source": "{\n \"scripts\": {\n \"check\": \"pnpm dlx some-tool\"\n }\n}",
|
|
7
|
+
"expectedLines": [3]
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"name": "download piped to a shell",
|
|
11
|
+
"fileName": "delivery/check.sh",
|
|
12
|
+
"source": "curl -fsSL https://example.test/setup | sh",
|
|
13
|
+
"expectedLines": [1]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "pnpx in a workflow run block",
|
|
17
|
+
"fileName": ".github/workflows/ci.yml",
|
|
18
|
+
"source": "- run: |\n pnpm run check\n pnpx some-tool\n",
|
|
19
|
+
"expectedLines": [3]
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"allow": [
|
|
23
|
+
{
|
|
24
|
+
"name": "repository script",
|
|
25
|
+
"fileName": "package.json",
|
|
26
|
+
"source": "{\"scripts\":{\"check\":\"pnpm run lint\"}}",
|
|
27
|
+
"expectedLines": []
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "local tools in a workflow run block",
|
|
31
|
+
"fileName": ".github/workflows/ci.yml",
|
|
32
|
+
"source": "- run: |\n pnpm exec vitest run\n pnpm run lint\n",
|
|
33
|
+
"expectedLines": []
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "indirect command is outside the scan",
|
|
37
|
+
"fileName": "delivery/check.sh",
|
|
38
|
+
"source": "runner=pnpm\n$runner dlx some-tool",
|
|
39
|
+
"expectedLines": []
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
package/src/infrastructure/engines/walker/tool-fetched-at-run-time/fetch-command/fetch-command.js
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PACKAGE_MANIFEST,
|
|
3
|
+
WORKFLOW,
|
|
4
|
+
dependencySourceOf,
|
|
5
|
+
locatedPackageManifestOf
|
|
6
|
+
} from "../../../../../../chunks/chunk-SKDQ3QJD.js";
|
|
7
|
+
import "../../../../../../chunks/chunk-DJMF6JIM.js";
|
|
8
|
+
import "../../../../../../chunks/chunk-COQMPHWZ.js";
|
|
9
|
+
import "../../../../../../chunks/chunk-DGOLOS5A.js";
|
|
10
|
+
|
|
11
|
+
// src/infrastructure/engines/walker/tool-fetched-at-run-time/fetch-command/fetch-command.ts
|
|
12
|
+
var SHELL = /\.(?:sh|bash|zsh|ps1|cmd|bat)$/;
|
|
13
|
+
var COMMAND_START = /(?:^|[;&|])\s*(?:exec\s+|call\s+)?(?:corepack\s+)?(?<quote>['"]?)(?:(?:npx|pnpx|bunx)(?:\.(?:cmd|bat|exe|ps1))?|bun\s+x|pnpm\s+dlx|yarn\s+dlx|npm\s+exec)\k<quote>(?=$|[\s;&|])/i;
|
|
14
|
+
var DOWNLOAD_PIPE = /(?:^|[;&|])\s*(?:curl|wget|iwr|irm|Invoke-WebRequest|Invoke-RestMethod)\b[^|\r\n]*\|\s*(?:sh|bash|zsh|pwsh|powershell|iex|Invoke-Expression)\b/i;
|
|
15
|
+
var GITLAB_SCRIPT = /^(?:-\s+)?(?:before_script|script|after_script|pre_get_sources_script)\s*:\s*/;
|
|
16
|
+
var GITLAB_VARIABLES = /^variables\s*:/;
|
|
17
|
+
var YAML_ANCHOR = /^[.\w-]+\s*:\s*&(?<anchor>[\w.-]+)(?:\s+(?<command>.*))?$/;
|
|
18
|
+
var YAML_ALIAS = /^\*(?<name>[\w.-]+)(?:\s+#.*)?$/;
|
|
19
|
+
var SEQUENCE_ITEM = /^-\s+/;
|
|
20
|
+
var WORKFLOW_COMMAND = /^(?:-\s+)?(?:run|script)\s*:\s*/;
|
|
21
|
+
var YAML_BLOCK = /^(?:&\S+\s*)?(?:[|>][+\d-]*)?(?:\s*#.*)?$/;
|
|
22
|
+
var YAML_STRING = /^(?:"(?<double>(?:[^"\\]|\\.)*)"|'(?<single>(?:[^']|'')*)')(?:\s+#.*)?$/;
|
|
23
|
+
var YAML_FLOW_LIST = /^\[(?<items>.*)\](?:\s+#.*)?$/;
|
|
24
|
+
var YAML_FLOW_ITEM = /(?:^|,)\s*(?<item>"(?:[^"\\]|\\.)*"|'(?:[^']|'')*'|[^,]+?)\s*(?=,|$)/g;
|
|
25
|
+
var yamlScalarOf = (source) => {
|
|
26
|
+
const quoted = YAML_STRING.exec(source)?.groups;
|
|
27
|
+
if (quoted?.double !== void 0) return quoted.double.replaceAll('\\"', '"');
|
|
28
|
+
if (quoted?.single !== void 0) return quoted.single.replaceAll("''", "'");
|
|
29
|
+
return source;
|
|
30
|
+
};
|
|
31
|
+
var yamlCommandOf = (source) => {
|
|
32
|
+
const flowItems = YAML_FLOW_LIST.exec(source)?.groups?.items;
|
|
33
|
+
if (flowItems === void 0) return yamlScalarOf(source);
|
|
34
|
+
return Array.from(
|
|
35
|
+
flowItems.matchAll(YAML_FLOW_ITEM),
|
|
36
|
+
(match) => yamlScalarOf(match.groups?.item ?? "")
|
|
37
|
+
).join("; ");
|
|
38
|
+
};
|
|
39
|
+
var isolatedYamlLines = (source) => source.split(/\r?\n/).flatMap((line, index) => {
|
|
40
|
+
const snippet = line.trim();
|
|
41
|
+
if (snippet.length === 0 || snippet.startsWith("#")) return [];
|
|
42
|
+
return [
|
|
43
|
+
{
|
|
44
|
+
snippet,
|
|
45
|
+
indent: line.length - line.trimStart().length,
|
|
46
|
+
anchor: { line: index + 1, column: 0 }
|
|
47
|
+
}
|
|
48
|
+
];
|
|
49
|
+
});
|
|
50
|
+
var scanCommandLine = (request) => {
|
|
51
|
+
const { scan, line, headerValueOf } = request;
|
|
52
|
+
const { snippet, indent, anchor } = line;
|
|
53
|
+
if (scan.variablesIndent !== void 0 && indent > scan.variablesIndent) return scan;
|
|
54
|
+
const current = { ...scan, variablesIndent: void 0 };
|
|
55
|
+
if (GITLAB_VARIABLES.test(snippet))
|
|
56
|
+
return { ...current, scriptIndent: void 0, variablesIndent: indent };
|
|
57
|
+
const command = headerValueOf(snippet);
|
|
58
|
+
if (command !== void 0) {
|
|
59
|
+
current.commands.push({ text: yamlCommandOf(command), anchor, snippet });
|
|
60
|
+
return { ...current, scriptIndent: YAML_BLOCK.test(command) ? indent : void 0 };
|
|
61
|
+
}
|
|
62
|
+
const { scriptIndent } = current;
|
|
63
|
+
if (scriptIndent === void 0) return current;
|
|
64
|
+
if (indent < scriptIndent || indent === scriptIndent && !SEQUENCE_ITEM.test(snippet))
|
|
65
|
+
return { ...current, scriptIndent: void 0 };
|
|
66
|
+
const text = SEQUENCE_ITEM.test(snippet) ? yamlCommandOf(snippet.replace(SEQUENCE_ITEM, "")) : snippet;
|
|
67
|
+
current.commands.push({ text, anchor, snippet });
|
|
68
|
+
return current;
|
|
69
|
+
};
|
|
70
|
+
var commandsUnder = (request) => request.lines.reduce(
|
|
71
|
+
(scan, line) => scanCommandLine({ scan, line, headerValueOf: request.headerValueOf }),
|
|
72
|
+
{ scriptIndent: void 0, variablesIndent: void 0, commands: [] }
|
|
73
|
+
).commands;
|
|
74
|
+
var gitlabCommandsOf = (source) => {
|
|
75
|
+
const lines = isolatedYamlLines(source);
|
|
76
|
+
const scripts = commandsUnder({
|
|
77
|
+
lines,
|
|
78
|
+
headerValueOf: (snippet) => GITLAB_SCRIPT.test(snippet) ? snippet.replace(GITLAB_SCRIPT, "") : void 0
|
|
79
|
+
});
|
|
80
|
+
const aliases = new Set(
|
|
81
|
+
scripts.flatMap(({ text }) => {
|
|
82
|
+
const name = YAML_ALIAS.exec(text)?.groups?.name;
|
|
83
|
+
return name === void 0 ? [] : [name];
|
|
84
|
+
})
|
|
85
|
+
);
|
|
86
|
+
if (aliases.size === 0) return scripts;
|
|
87
|
+
const anchors = commandsUnder({
|
|
88
|
+
lines,
|
|
89
|
+
headerValueOf: (snippet) => {
|
|
90
|
+
const definition = YAML_ANCHOR.exec(snippet)?.groups;
|
|
91
|
+
return definition?.anchor !== void 0 && aliases.has(definition.anchor) ? definition.command ?? "" : void 0;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
return [
|
|
95
|
+
...new Map([...scripts, ...anchors].map((command) => [command.anchor.line, command])).values()
|
|
96
|
+
].toSorted((left, right) => left.anchor.line - right.anchor.line);
|
|
97
|
+
};
|
|
98
|
+
var sourceCommandsOf = (request) => request.source.split(/\r?\n/).flatMap((line, index) => {
|
|
99
|
+
const snippet = line.trim();
|
|
100
|
+
if (snippet.startsWith("#") || snippet.startsWith("::")) return [];
|
|
101
|
+
const text = request.kind === "workflow" && WORKFLOW_COMMAND.test(snippet) ? yamlCommandOf(snippet.replace(WORKFLOW_COMMAND, "")) : snippet;
|
|
102
|
+
return [{ text, anchor: { line: index + 1, column: 0 }, snippet }];
|
|
103
|
+
});
|
|
104
|
+
var manifestCommandsOf = (file) => {
|
|
105
|
+
const located = locatedPackageManifestOf(file);
|
|
106
|
+
if (located.outcome === "failed") return located;
|
|
107
|
+
const manifest = located.value;
|
|
108
|
+
if (manifest === void 0) return { outcome: "ok", value: void 0 };
|
|
109
|
+
return {
|
|
110
|
+
outcome: "ok",
|
|
111
|
+
value: Array.from(manifest.get("scripts")?.fields.values() ?? []).flatMap(
|
|
112
|
+
({ value: text, anchor, snippet }) => typeof text === "string" ? [{ text, anchor, snippet }] : []
|
|
113
|
+
)
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
var commandFileOf = (file) => {
|
|
117
|
+
const workflow = WORKFLOW.exec(file);
|
|
118
|
+
if (workflow === null) return "shell";
|
|
119
|
+
return workflow.groups?.gitlab === void 0 ? "workflow" : "gitlab";
|
|
120
|
+
};
|
|
121
|
+
var fileCommandsOf = (file) => {
|
|
122
|
+
const source = dependencySourceOf({ ...file, accepts: file.kind === "shell" ? SHELL : WORKFLOW });
|
|
123
|
+
return source.outcome === "failed" ? source : {
|
|
124
|
+
outcome: "ok",
|
|
125
|
+
value: source.value === void 0 ? void 0 : file.kind === "gitlab" ? gitlabCommandsOf(source.value) : sourceCommandsOf({ source: source.value, kind: file.kind })
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
var check = {
|
|
129
|
+
prepare: ({ bindings }) => ({
|
|
130
|
+
outcome: "ok",
|
|
131
|
+
value: {
|
|
132
|
+
prepareFile: (file) => {
|
|
133
|
+
const manifest = PACKAGE_MANIFEST.test(file.file);
|
|
134
|
+
const commands = manifest ? manifestCommandsOf(file) : fileCommandsOf({ ...file, kind: commandFileOf(file.file) });
|
|
135
|
+
if (commands.outcome === "failed") return commands;
|
|
136
|
+
if (commands.value === void 0) return { outcome: "ok", value: { kind: "skipped" } };
|
|
137
|
+
const hits = commands.value.filter(({ text }) => COMMAND_START.test(text) || DOWNLOAD_PIPE.test(text)).flatMap(
|
|
138
|
+
({ anchor, snippet }) => bindings.map(({ address }) => ({
|
|
139
|
+
check: address,
|
|
140
|
+
anchor,
|
|
141
|
+
snippet
|
|
142
|
+
}))
|
|
143
|
+
);
|
|
144
|
+
return { outcome: "ok", value: { kind: "complete", hits } };
|
|
145
|
+
},
|
|
146
|
+
finish: () => ({ outcome: "ok", value: [] })
|
|
147
|
+
}
|
|
148
|
+
})
|
|
149
|
+
};
|
|
150
|
+
export {
|
|
151
|
+
check
|
|
152
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"flag": [
|
|
3
|
+
{
|
|
4
|
+
"name": "types defined inside a test file",
|
|
5
|
+
"fileName": "src/order.test.ts",
|
|
6
|
+
"source": "type Amount = number;\ninterface Item { amount: Amount }\nenum State { Written }",
|
|
7
|
+
"expectedLines": [1, 2, 3]
|
|
8
|
+
}
|
|
9
|
+
],
|
|
10
|
+
"allow": [
|
|
11
|
+
{
|
|
12
|
+
"name": "types are imported from their owner",
|
|
13
|
+
"fileName": "src/order.test.ts",
|
|
14
|
+
"source": "import type { Amount } from \"./order.ts\";\nconst input: Amount = 1;",
|
|
15
|
+
"expectedLines": []
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "inline type literal",
|
|
19
|
+
"fileName": "src/order.test.ts",
|
|
20
|
+
"source": "const input = { amount: 1 } satisfies { amount: number };",
|
|
21
|
+
"expectedLines": []
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
syntaxNodeCheck
|
|
3
|
+
} from "../../../../../../chunks/chunk-LEFM7OPS.js";
|
|
4
|
+
import "../../../../../../chunks/chunk-5AKHEW6V.js";
|
|
5
|
+
import {
|
|
6
|
+
testFileEligibility
|
|
7
|
+
} from "../../../../../../chunks/chunk-COQMPHWZ.js";
|
|
8
|
+
import "../../../../../../chunks/chunk-DGOLOS5A.js";
|
|
9
|
+
|
|
10
|
+
// src/infrastructure/engines/walker/type-declared-in-a-test/test-type-declaration/test-type-declaration.ts
|
|
11
|
+
var enclosingAugmentation = ({
|
|
12
|
+
syntaxApi,
|
|
13
|
+
node
|
|
14
|
+
}) => {
|
|
15
|
+
const container = node.parent;
|
|
16
|
+
if (syntaxApi.isSourceFile(container)) return void 0;
|
|
17
|
+
if (syntaxApi.isModuleDeclaration(container) && (syntaxApi.isStringLiteral(container.name) || (container.flags & syntaxApi.NodeFlags.GlobalAugmentation) !== 0))
|
|
18
|
+
return container;
|
|
19
|
+
return enclosingAugmentation({ syntaxApi, node: container });
|
|
20
|
+
};
|
|
21
|
+
var check = syntaxNodeCheck({
|
|
22
|
+
eligibility: testFileEligibility,
|
|
23
|
+
found: ({ syntaxApi, node, sourceFile }) => (syntaxApi.isTypeAliasDeclaration(node) || syntaxApi.isInterfaceDeclaration(node) || syntaxApi.isEnumDeclaration(node)) && enclosingAugmentation({ syntaxApi, node }) === void 0 ? { at: node, snippet: node.name.getText(sourceFile) } : void 0
|
|
24
|
+
});
|
|
25
|
+
export {
|
|
26
|
+
check
|
|
27
|
+
};
|