@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
package/src/infrastructure/engines/walker/floating-version/version-selector/version-selector.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
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/floating-version/version-selector/version-selector.ts
|
|
12
|
+
var EXACT_VERSION = /^[=v]?(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\da-z.-]+)?(?:\+[\da-z.-]+)?$/i;
|
|
13
|
+
var LOCAL_SPECIFIER = /^(?:file|link|workspace):/;
|
|
14
|
+
var GIT_COMMIT = /#[\da-f]{40}$/i;
|
|
15
|
+
var ACTION_COMMIT = /@[\da-f]{40}$/i;
|
|
16
|
+
var DOCKER_DIGEST = /@sha256:[\da-f]{64}$/i;
|
|
17
|
+
var WORKFLOW_VERSION = /^\s*(?:-\s+)?(uses|(?:node|python|go|ruby|java|dotnet|bun|pnpm)-version)\s*:\s*(\S.*?)\s*$/;
|
|
18
|
+
var floatingSpecifier = (text) => {
|
|
19
|
+
const specifier = text.trim();
|
|
20
|
+
if (LOCAL_SPECIFIER.test(specifier) || GIT_COMMIT.test(specifier)) return false;
|
|
21
|
+
const version = specifier.startsWith("npm:") ? specifier.slice(specifier.lastIndexOf("@") + 1) : specifier;
|
|
22
|
+
return !EXACT_VERSION.test(version);
|
|
23
|
+
};
|
|
24
|
+
var floatingWorkflowVersion = (line) => {
|
|
25
|
+
const match = WORKFLOW_VERSION.exec(line.replace(/\s+#.*$/, ""));
|
|
26
|
+
const value = match?.[2]?.replace(/^(?:'|")|(?:'|")$/g, "");
|
|
27
|
+
if (value === void 0 || value.includes("${{")) return false;
|
|
28
|
+
return match?.[1] === "uses" ? !value.startsWith("./") && !ACTION_COMMIT.test(value) && !DOCKER_DIGEST.test(value) : !EXACT_VERSION.test(value);
|
|
29
|
+
};
|
|
30
|
+
var manifestVersionsOf = (file) => {
|
|
31
|
+
const manifest = locatedPackageManifestOf(file);
|
|
32
|
+
if (manifest.outcome === "failed") return manifest;
|
|
33
|
+
const { value } = manifest;
|
|
34
|
+
if (value === void 0) return { outcome: "ok", value: void 0 };
|
|
35
|
+
const sections = value.get("private")?.value === true ? ["dependencies", "devDependencies", "optionalDependencies"] : ["devDependencies"];
|
|
36
|
+
const floating = sections.flatMap(
|
|
37
|
+
(section) => Array.from(value.get(section)?.fields.values() ?? []).filter(
|
|
38
|
+
({ value: version }) => typeof version === "string" && floatingSpecifier(version)
|
|
39
|
+
)
|
|
40
|
+
);
|
|
41
|
+
const packageManager = value.get("packageManager");
|
|
42
|
+
if (typeof packageManager?.value === "string" && floatingSpecifier(packageManager.value.slice(packageManager.value.lastIndexOf("@") + 1))) {
|
|
43
|
+
floating.push(packageManager);
|
|
44
|
+
}
|
|
45
|
+
return { outcome: "ok", value: floating };
|
|
46
|
+
};
|
|
47
|
+
var workflowVersionsOf = (file) => {
|
|
48
|
+
const source = dependencySourceOf({ ...file, accepts: WORKFLOW });
|
|
49
|
+
return source.outcome === "failed" ? source : {
|
|
50
|
+
outcome: "ok",
|
|
51
|
+
value: source.value?.split(/\r?\n/).flatMap(
|
|
52
|
+
(line, index) => floatingWorkflowVersion(line) ? [{ anchor: { line: index + 1, column: 0 }, snippet: line.trim() }] : []
|
|
53
|
+
)
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
var check = {
|
|
57
|
+
prepare: ({ bindings }) => ({
|
|
58
|
+
outcome: "ok",
|
|
59
|
+
value: {
|
|
60
|
+
prepareFile: (file) => {
|
|
61
|
+
const versions = PACKAGE_MANIFEST.test(file.file) ? manifestVersionsOf(file) : workflowVersionsOf(file);
|
|
62
|
+
if (versions.outcome === "failed") return versions;
|
|
63
|
+
if (versions.value === void 0) return { outcome: "ok", value: { kind: "skipped" } };
|
|
64
|
+
const hits = versions.value.flatMap(
|
|
65
|
+
({ anchor, snippet }) => bindings.map(({ address }) => ({ check: address, anchor, snippet }))
|
|
66
|
+
);
|
|
67
|
+
return { outcome: "ok", value: { kind: "complete", hits } };
|
|
68
|
+
},
|
|
69
|
+
finish: () => ({ outcome: "ok", value: [] })
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
};
|
|
73
|
+
export {
|
|
74
|
+
check
|
|
75
|
+
};
|
|
@@ -1,30 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
|
+
fileRoleOf,
|
|
2
3
|
folderScope
|
|
3
|
-
} from "../../../../../../chunks/chunk-
|
|
4
|
+
} from "../../../../../../chunks/chunk-COQMPHWZ.js";
|
|
4
5
|
import "../../../../../../chunks/chunk-DGOLOS5A.js";
|
|
5
6
|
|
|
6
7
|
// src/infrastructure/engines/walker/inherited-environment-in-a-subprocess/git-spawn-environment/hermetic-git-spawns.ts
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
".test.tsx",
|
|
10
|
-
".test.mjs",
|
|
11
|
-
".test.js",
|
|
12
|
-
".spec.ts",
|
|
13
|
-
".spec.mjs"
|
|
14
|
-
];
|
|
15
|
-
var testFileEligibility = (request) => {
|
|
16
|
-
if (folderScope({ file: request.file }) === "generated") return "skipped";
|
|
17
|
-
return TEST_FILE_SUFFIXES.some((suffix) => request.file.endsWith(suffix)) ? "eligible" : "skipped";
|
|
18
|
-
};
|
|
8
|
+
var TEST_EXTENSION = /\.(?:tsx?|mjs|js)$/;
|
|
9
|
+
var testFileEligibility = (request) => folderScope(request) === "authored" && TEST_EXTENSION.test(request.file) && fileRoleOf(request) === "test" ? "eligible" : "skipped";
|
|
19
10
|
var GIT_SPAWN_PATTERN = /\b(?:spawnSync|spawn|execFileSync|execFile|execSync|exec|execa|execaSync)\s*\(\s*(?:"git"|'git'|`git`)/;
|
|
20
11
|
var HERMETIC_ENVIRONMENT_PATTERN = /\benv\s*:\s*[^,\n]*\b(?:hermeticGitEnvironment|withoutInheritedGitBindings|environment)\b/;
|
|
21
12
|
var AMBIENT_ENVIRONMENT_PATTERN = /\benv\s*:\s*[^,\n]*\bprocess\.env\b/;
|
|
22
13
|
var check = {
|
|
23
|
-
prepare: ({
|
|
14
|
+
prepare: ({ bindings, repository }) => ({
|
|
24
15
|
outcome: "ok",
|
|
25
16
|
value: {
|
|
26
17
|
prepareFile: ({ file, readText }) => {
|
|
27
|
-
if (testFileEligibility({ file }) === "skipped") {
|
|
18
|
+
if (testFileEligibility({ file, testFiles: repository.testFiles }) === "skipped") {
|
|
28
19
|
return { outcome: "ok", value: { kind: "skipped" } };
|
|
29
20
|
}
|
|
30
21
|
const text = readText();
|
|
@@ -35,8 +26,8 @@ var check = {
|
|
|
35
26
|
const span = lines.slice(index, index + 8);
|
|
36
27
|
if (!span.some((nearby) => AMBIENT_ENVIRONMENT_PATTERN.test(nearby)) && span.some((nearby) => HERMETIC_ENVIRONMENT_PATTERN.test(nearby)))
|
|
37
28
|
return [];
|
|
38
|
-
return
|
|
39
|
-
|
|
29
|
+
return bindings.map((binding) => ({
|
|
30
|
+
check: binding.address,
|
|
40
31
|
anchor: { line: index + 1, column: 0 },
|
|
41
32
|
snippet: line.trim()
|
|
42
33
|
}));
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
compactSourceSnippetOf
|
|
3
|
+
} from "../../../../../../chunks/chunk-5AKHEW6V.js";
|
|
1
4
|
import {
|
|
2
5
|
folderScope
|
|
3
|
-
} from "../../../../../../chunks/chunk-
|
|
6
|
+
} from "../../../../../../chunks/chunk-COQMPHWZ.js";
|
|
4
7
|
import "../../../../../../chunks/chunk-DGOLOS5A.js";
|
|
5
8
|
|
|
6
9
|
// src/infrastructure/engines/walker/loop-keyword/loop-statement/loops.ts
|
|
@@ -13,7 +16,7 @@ var FOR_OF = /\bfor\s*(?:await\s*)?\(\s*(?:const|let|var)?[^;()]*\bof\b/;
|
|
|
13
16
|
var COUNTED_FOR = /\bfor\s*\([^)]*;[^)]*;[^)]*\)/;
|
|
14
17
|
var WHILE_LOOP = /\bwhile\s*\(/;
|
|
15
18
|
var check = {
|
|
16
|
-
prepare: ({
|
|
19
|
+
prepare: ({ bindings }) => ({
|
|
17
20
|
outcome: "ok",
|
|
18
21
|
value: {
|
|
19
22
|
prepareFile: ({ file, readText }) => {
|
|
@@ -26,11 +29,10 @@ var check = {
|
|
|
26
29
|
const trimmed = line.trim();
|
|
27
30
|
if (trimmed.startsWith("//") || trimmed.startsWith("*") || trimmed.startsWith("/*"))
|
|
28
31
|
return [];
|
|
29
|
-
const
|
|
30
|
-
const snippet = collapsed.length > 80 ? `${collapsed.slice(0, 80)}\u2026` : collapsed;
|
|
32
|
+
const snippet = compactSourceSnippetOf(trimmed);
|
|
31
33
|
return [FOR_OF, COUNTED_FOR, WHILE_LOOP].flatMap(
|
|
32
|
-
(pattern) => pattern.test(line) ?
|
|
33
|
-
|
|
34
|
+
(pattern) => pattern.test(line) ? bindings.map((binding) => ({
|
|
35
|
+
check: binding.address,
|
|
34
36
|
anchor: { line: index + 1, column: 0 },
|
|
35
37
|
snippet
|
|
36
38
|
})) : []
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"flag": [
|
|
3
|
+
{
|
|
4
|
+
"name": "Vitest test and suite aliases",
|
|
5
|
+
"fileName": "src/orders.test.ts",
|
|
6
|
+
"source": "import { test, suite } from \"vitest\";\ntest(\"sends the order\", () => {});\nsuite.skip(\"orders\", () => {});",
|
|
7
|
+
"expectedLines": [2, 3]
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"name": "test aliases available as globals",
|
|
11
|
+
"fileName": "src/orders.test.tsx",
|
|
12
|
+
"source": "test.each([1])(\"order %s\", () => {});\nsuite(\"orders\", () => {});",
|
|
13
|
+
"expectedLines": [1, 2]
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"allow": [
|
|
17
|
+
{
|
|
18
|
+
"name": "the test vocabulary",
|
|
19
|
+
"fileName": "src/orders.test.ts",
|
|
20
|
+
"source": "import { it, describe } from \"vitest\";\ndescribe(\"orders\", () => { it(\"sends\", () => {}); });",
|
|
21
|
+
"expectedLines": []
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "an unrelated local binding",
|
|
25
|
+
"fileName": "src/orders.test.ts",
|
|
26
|
+
"source": "const test = (value: number) => value > 0;\ntest(1);",
|
|
27
|
+
"expectedLines": []
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "the check stays in test files",
|
|
31
|
+
"fileName": "src/orders.ts",
|
|
32
|
+
"source": "test(1);",
|
|
33
|
+
"expectedLines": []
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {
|
|
2
|
+
calleeRootOf,
|
|
3
|
+
vitestImportedNameOf
|
|
4
|
+
} from "../../../../../../chunks/chunk-3CWFUD5B.js";
|
|
5
|
+
import "../../../../../../chunks/chunk-EBX57Z3V.js";
|
|
6
|
+
import {
|
|
7
|
+
sourceBindingsOf
|
|
8
|
+
} from "../../../../../../chunks/chunk-75XWZYNN.js";
|
|
9
|
+
import {
|
|
10
|
+
testFileEligibility
|
|
11
|
+
} from "../../../../../../chunks/chunk-COQMPHWZ.js";
|
|
12
|
+
import "../../../../../../chunks/chunk-DGOLOS5A.js";
|
|
13
|
+
|
|
14
|
+
// src/infrastructure/engines/walker/many-spellings-of-one-concept/test-call-aliases/test-call-aliases.ts
|
|
15
|
+
var VITEST_TEST_NAMES = /* @__PURE__ */ new Set(["test", "it", "suite", "describe"]);
|
|
16
|
+
var testAliasSites = (request) => {
|
|
17
|
+
if (request.candidates.length === 0) return [];
|
|
18
|
+
const checker = sourceBindingsOf(request);
|
|
19
|
+
return request.candidates.filter((node) => {
|
|
20
|
+
const symbol = checker.getSymbolAtLocation(node);
|
|
21
|
+
return symbol === void 0 || (symbol.declarations ?? []).some((declaration) => {
|
|
22
|
+
const importedName = vitestImportedNameOf({
|
|
23
|
+
syntaxApi: request.syntaxApi,
|
|
24
|
+
node: declaration
|
|
25
|
+
});
|
|
26
|
+
return importedName !== void 0 && VITEST_TEST_NAMES.has(importedName);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
var check = {
|
|
31
|
+
prepare: ({ bindings, repository, syntaxApi }) => ({
|
|
32
|
+
outcome: "ok",
|
|
33
|
+
value: {
|
|
34
|
+
prepareFile: ({ file }) => testFileEligibility({ file, testFiles: repository.testFiles }) === "skipped" ? { outcome: "ok", value: { kind: "skipped" } } : {
|
|
35
|
+
outcome: "ok",
|
|
36
|
+
value: {
|
|
37
|
+
kind: "syntax",
|
|
38
|
+
begin: ({ sourceFile, anchorAt }) => {
|
|
39
|
+
const candidates = /* @__PURE__ */ new Set();
|
|
40
|
+
return {
|
|
41
|
+
enter: ({ node }) => {
|
|
42
|
+
if (!syntaxApi.isCallExpression(node)) return;
|
|
43
|
+
const root = calleeRootOf({ syntaxApi, node: node.expression });
|
|
44
|
+
if (root?.text === "test" || root?.text === "suite") candidates.add(root);
|
|
45
|
+
},
|
|
46
|
+
finish: () => testAliasSites({
|
|
47
|
+
syntaxApi,
|
|
48
|
+
sourceFile,
|
|
49
|
+
candidates: [...candidates]
|
|
50
|
+
}).flatMap(
|
|
51
|
+
(node) => bindings.map(({ address }) => ({
|
|
52
|
+
check: address,
|
|
53
|
+
anchor: anchorAt({ position: node.getStart(sourceFile) }),
|
|
54
|
+
snippet: node.getText(sourceFile)
|
|
55
|
+
}))
|
|
56
|
+
)
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
finish: () => ({ outcome: "ok", value: [] })
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
};
|
|
65
|
+
export {
|
|
66
|
+
check
|
|
67
|
+
};
|
|
@@ -11,6 +11,13 @@
|
|
|
11
11
|
"fileName": "view.test.tsx",
|
|
12
12
|
"source": "import { vi } from \"vitest\";\nvi.mock(\"module\");\n",
|
|
13
13
|
"expectedLines": [2]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "global stub and environment writes",
|
|
17
|
+
"fileName": "globals.test.ts",
|
|
18
|
+
"source": "vi.stubGlobal('focus', value);\nvi.stubEnv('MODE', 'test');\nprocess.env.MODE = 'test';\ndelete process.env.OLD;\nprocess.env.COUNT++;",
|
|
19
|
+
"expectedLines": [1, 2, 3, 4, 5],
|
|
20
|
+
"edition": "2"
|
|
14
21
|
}
|
|
15
22
|
],
|
|
16
23
|
"allow": [
|
|
@@ -31,6 +38,33 @@
|
|
|
31
38
|
"fileName": "bracket.test.ts",
|
|
32
39
|
"source": "vi[\"mock\"](\"module\");\n",
|
|
33
40
|
"expectedLines": []
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "edition one does not adopt global patches",
|
|
44
|
+
"fileName": "globals.test.ts",
|
|
45
|
+
"source": "vi.stubGlobal('focus', value);\nvi.stubEnv('MODE', 'test');",
|
|
46
|
+
"expectedLines": []
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "global spies are outside this check",
|
|
50
|
+
"fileName": "globals.test.ts",
|
|
51
|
+
"source": "vi.spyOn(globalThis, 'fetch');",
|
|
52
|
+
"expectedLines": [],
|
|
53
|
+
"edition": "2"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "environment reads and aliases",
|
|
57
|
+
"fileName": "globals.test.ts",
|
|
58
|
+
"source": "const environment = process.env;\nenvironment.MODE = 'test';\nconst mode = process.env.MODE;",
|
|
59
|
+
"expectedLines": [],
|
|
60
|
+
"edition": "2"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "global patch outside a test",
|
|
64
|
+
"fileName": "setup.ts",
|
|
65
|
+
"source": "vi.stubGlobal('focus', value);\nprocess.env.MODE = 'test';",
|
|
66
|
+
"expectedLines": [],
|
|
67
|
+
"edition": "2"
|
|
34
68
|
}
|
|
35
69
|
]
|
|
36
70
|
}
|
|
@@ -1,25 +1,75 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../../../../../../chunks/chunk-
|
|
2
|
+
editionOf
|
|
3
|
+
} from "../../../../../../chunks/chunk-RFR3ITBS.js";
|
|
4
|
+
import {
|
|
5
|
+
sourceSnippetAt
|
|
6
|
+
} from "../../../../../../chunks/chunk-5AKHEW6V.js";
|
|
7
|
+
import {
|
|
8
|
+
testFileEligibility
|
|
9
|
+
} from "../../../../../../chunks/chunk-COQMPHWZ.js";
|
|
10
|
+
import {
|
|
11
|
+
editionReaches
|
|
12
|
+
} from "../../../../../../chunks/chunk-RANIXNWY.js";
|
|
4
13
|
import "../../../../../../chunks/chunk-DGOLOS5A.js";
|
|
5
14
|
|
|
6
15
|
// src/infrastructure/engines/walker/module-or-global-patched/module-mock-call/module-mocking.ts
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
16
|
+
var GLOBAL_PATCH_EDITION = editionOf("2");
|
|
17
|
+
var VITEST_GLOBAL_STUBS = /* @__PURE__ */ new Set(["stubGlobal", "stubEnv"]);
|
|
18
|
+
var memberOf = ({
|
|
19
|
+
syntaxApi,
|
|
20
|
+
node
|
|
21
|
+
}) => {
|
|
22
|
+
if (syntaxApi.isPropertyAccessExpression(node))
|
|
23
|
+
return { receiver: node.expression, name: node.name.text };
|
|
24
|
+
if (syntaxApi.isElementAccessExpression(node) && syntaxApi.isStringLiteralLike(node.argumentExpression)) {
|
|
25
|
+
return { receiver: node.expression, name: node.argumentExpression.text };
|
|
26
|
+
}
|
|
27
|
+
return void 0;
|
|
28
|
+
};
|
|
29
|
+
var environmentOf = ({ syntaxApi, node }) => {
|
|
30
|
+
const member = memberOf({ syntaxApi, node });
|
|
31
|
+
if (member?.name !== "env" || !syntaxApi.isIdentifier(member.receiver) || member.receiver.text !== "process")
|
|
32
|
+
return void 0;
|
|
33
|
+
return node;
|
|
34
|
+
};
|
|
35
|
+
var writtenTarget = ({ syntaxApi, node }) => {
|
|
36
|
+
const kind = syntaxApi.SyntaxKind;
|
|
37
|
+
if (syntaxApi.isBinaryExpression(node) && node.operatorToken.kind >= kind.FirstAssignment && node.operatorToken.kind <= kind.LastAssignment)
|
|
38
|
+
return node.left;
|
|
39
|
+
if (syntaxApi.isDeleteExpression(node)) return node.expression;
|
|
40
|
+
if ((syntaxApi.isPrefixUnaryExpression(node) || syntaxApi.isPostfixUnaryExpression(node)) && (node.operator === kind.PlusPlusToken || node.operator === kind.MinusMinusToken))
|
|
41
|
+
return node.operand;
|
|
42
|
+
return void 0;
|
|
43
|
+
};
|
|
44
|
+
var globalPatchOf = (request) => {
|
|
45
|
+
const { syntaxApi, node } = request;
|
|
46
|
+
if (syntaxApi.isCallExpression(node)) {
|
|
47
|
+
const member = memberOf({ syntaxApi, node: node.expression });
|
|
48
|
+
return member !== void 0 && VITEST_GLOBAL_STUBS.has(member.name) && syntaxApi.isIdentifier(member.receiver) && member.receiver.text === "vi" ? node : void 0;
|
|
49
|
+
}
|
|
50
|
+
const target = writtenTarget(request);
|
|
51
|
+
if (target === void 0) return void 0;
|
|
52
|
+
if (environmentOf({ syntaxApi, node: target }) !== void 0) return node;
|
|
53
|
+
if (!syntaxApi.isPropertyAccessExpression(target) && !syntaxApi.isElementAccessExpression(target))
|
|
54
|
+
return void 0;
|
|
55
|
+
return environmentOf({ syntaxApi, node: target.expression }) === void 0 ? void 0 : node;
|
|
10
56
|
};
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
57
|
+
var moduleMockOf = ({ syntaxApi, node }) => {
|
|
58
|
+
if (!syntaxApi.isCallExpression(node)) return void 0;
|
|
59
|
+
const callee = node.expression;
|
|
60
|
+
return syntaxApi.isPropertyAccessExpression(callee) && callee.name.text === "mock" && syntaxApi.isIdentifier(callee.expression) && callee.expression.text === "vi" ? node : void 0;
|
|
14
61
|
};
|
|
15
62
|
var check = {
|
|
16
|
-
prepare: ({
|
|
63
|
+
prepare: ({ bindings, repository, syntaxApi }) => ({
|
|
17
64
|
outcome: "ok",
|
|
18
65
|
value: {
|
|
19
66
|
prepareFile: ({ file }) => {
|
|
20
|
-
if (testFileEligibility({ file }) === "skipped") {
|
|
67
|
+
if (testFileEligibility({ file, testFiles: repository.testFiles }) === "skipped" || bindings.length === 0) {
|
|
21
68
|
return { outcome: "ok", value: { kind: "skipped" } };
|
|
22
69
|
}
|
|
70
|
+
const globalPatchBindings = bindings.filter(
|
|
71
|
+
({ edition }) => editionReaches({ edition, introducedIn: GLOBAL_PATCH_EDITION }) === "reached"
|
|
72
|
+
);
|
|
23
73
|
return {
|
|
24
74
|
outcome: "ok",
|
|
25
75
|
value: {
|
|
@@ -28,15 +78,13 @@ var check = {
|
|
|
28
78
|
const hits = [];
|
|
29
79
|
return {
|
|
30
80
|
enter: ({ node }) => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (!syntaxApi.isPropertyAccessExpression(callee) || callee.name.text !== "mock" || !syntaxApi.isIdentifier(callee.expression) || callee.expression.text !== "vi")
|
|
34
|
-
return;
|
|
81
|
+
const findingBindings = moduleMockOf({ syntaxApi, node }) !== void 0 ? bindings : globalPatchBindings.length > 0 && globalPatchOf({ syntaxApi, node }) !== void 0 ? globalPatchBindings : [];
|
|
82
|
+
if (findingBindings.length === 0) return;
|
|
35
83
|
const position = node.getStart(sourceFile);
|
|
36
84
|
const anchor = anchorAt({ position });
|
|
37
|
-
const snippet =
|
|
85
|
+
const snippet = sourceSnippetAt({ source: sourceFile.text, position });
|
|
38
86
|
hits.push(
|
|
39
|
-
...
|
|
87
|
+
...findingBindings.map(({ address }) => ({ check: address, anchor, snippet }))
|
|
40
88
|
);
|
|
41
89
|
},
|
|
42
90
|
finish: () => hits
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"flag": [
|
|
3
|
+
{
|
|
4
|
+
"name": "dependency without a tracked lock",
|
|
5
|
+
"fileName": "packages/order/package.json",
|
|
6
|
+
"source": "{\n \"dependencies\": { \"some-tool\": \"1.2.3\" }\n}",
|
|
7
|
+
"expectedLines": [2]
|
|
8
|
+
}
|
|
9
|
+
],
|
|
10
|
+
"allow": [
|
|
11
|
+
{
|
|
12
|
+
"name": "dependency-free manifest",
|
|
13
|
+
"fileName": "package.json",
|
|
14
|
+
"source": "{\"name\":\"order\"}",
|
|
15
|
+
"expectedLines": []
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "peer-only manifest",
|
|
19
|
+
"fileName": "package.json",
|
|
20
|
+
"source": "{\"peerDependencies\":{\"react\":\"^19.0.0\"}}",
|
|
21
|
+
"expectedLines": []
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
package/src/infrastructure/engines/walker/no-lock-file/committed-lock-file/committed-lock-file.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {
|
|
2
|
+
locatedPackageManifestOf
|
|
3
|
+
} from "../../../../../../chunks/chunk-SKDQ3QJD.js";
|
|
4
|
+
import "../../../../../../chunks/chunk-DJMF6JIM.js";
|
|
5
|
+
import "../../../../../../chunks/chunk-COQMPHWZ.js";
|
|
6
|
+
import "../../../../../../chunks/chunk-DGOLOS5A.js";
|
|
7
|
+
|
|
8
|
+
// src/infrastructure/engines/walker/no-lock-file/committed-lock-file/committed-lock-file.ts
|
|
9
|
+
var DEPENDENCY_SECTIONS = ["dependencies", "devDependencies", "optionalDependencies"];
|
|
10
|
+
var LOCK_FILE = /(?:^|\/)(?:package-lock\.json|npm-shrinkwrap\.json|pnpm-lock\.yaml|yarn\.lock|bun\.lockb?)$/;
|
|
11
|
+
var directoryOf = (file) => file.slice(0, file.lastIndexOf("/") + 1);
|
|
12
|
+
var check = {
|
|
13
|
+
prepare: ({ bindings, repository }) => {
|
|
14
|
+
const lockDirectories = repository.files.filter((file) => LOCK_FILE.test(file)).map(directoryOf);
|
|
15
|
+
return {
|
|
16
|
+
outcome: "ok",
|
|
17
|
+
value: {
|
|
18
|
+
prepareFile: (file) => {
|
|
19
|
+
const manifest = locatedPackageManifestOf(file);
|
|
20
|
+
if (manifest.outcome === "failed") return manifest;
|
|
21
|
+
const { value } = manifest;
|
|
22
|
+
if (value === void 0) return { outcome: "ok", value: { kind: "skipped" } };
|
|
23
|
+
const site = DEPENDENCY_SECTIONS.map((section) => value.get(section)).find(
|
|
24
|
+
(field) => field !== void 0 && field.fields.size > 0
|
|
25
|
+
);
|
|
26
|
+
const covered = lockDirectories.some((directory) => file.file.startsWith(directory));
|
|
27
|
+
const hits = site !== void 0 && !covered ? bindings.map(({ address }) => ({
|
|
28
|
+
check: address,
|
|
29
|
+
anchor: site.anchor,
|
|
30
|
+
snippet: site.snippet
|
|
31
|
+
})) : [];
|
|
32
|
+
return { outcome: "ok", value: { kind: "complete", hits } };
|
|
33
|
+
},
|
|
34
|
+
finish: () => ({ outcome: "ok", value: [] })
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
check
|
|
41
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../../../../../../chunks/chunk-
|
|
2
|
+
stringListCheckSettings
|
|
3
|
+
} from "../../../../../../chunks/chunk-W5OIAUDW.js";
|
|
4
4
|
import {
|
|
5
5
|
folderScope
|
|
6
|
-
} from "../../../../../../chunks/chunk-
|
|
6
|
+
} from "../../../../../../chunks/chunk-COQMPHWZ.js";
|
|
7
7
|
import {
|
|
8
8
|
gatheredOutcomes
|
|
9
|
-
} from "../../../../../../chunks/chunk-
|
|
9
|
+
} from "../../../../../../chunks/chunk-YONPKP3C.js";
|
|
10
10
|
import "../../../../../../chunks/chunk-DGOLOS5A.js";
|
|
11
11
|
|
|
12
12
|
// src/infrastructure/engines/walker/outside-import-past-a-boundary/import-or-require/import-boundaries.ts
|
|
@@ -19,8 +19,8 @@ var escapedPackage = (request) => request.packageName.replace(/[.*+?^${}()|[\]\\
|
|
|
19
19
|
var confinedImportPattern = (request) => new RegExp(
|
|
20
20
|
`from\\s+["']((?:${request.packageNames.map((packageName) => escapedPackage({ packageName })).join("|")})(?:/[^"']*)?)["']`
|
|
21
21
|
);
|
|
22
|
-
var
|
|
23
|
-
|
|
22
|
+
var confinedCheckOf = (request) => ({
|
|
23
|
+
binding: request.binding,
|
|
24
24
|
anywhere: request.packageNames.length === 0 ? void 0 : confinedImportPattern({ packageNames: request.packageNames }),
|
|
25
25
|
patterns: request.packageNames.map((packageName) => ({
|
|
26
26
|
pattern: confinedImportPattern({ packageNames: [packageName] })
|
|
@@ -38,7 +38,7 @@ var confinedImportsIn = (request) => {
|
|
|
38
38
|
};
|
|
39
39
|
var confinedImportHits = (request) => request.confined.flatMap(
|
|
40
40
|
(confined) => confinedImportsIn({ text: request.text, confined }).map(({ line, specifier }) => ({
|
|
41
|
-
|
|
41
|
+
check: confined.binding.address,
|
|
42
42
|
anchor: { line, column: 0 },
|
|
43
43
|
snippet: `banned third-party import: ${specifier} \u2014 use its recorded wrapping boundary`,
|
|
44
44
|
importSpecifier: specifier
|
|
@@ -70,26 +70,28 @@ var nodeSchemeImportOf = (request) => {
|
|
|
70
70
|
};
|
|
71
71
|
var nodeSchemeHits = (request) => {
|
|
72
72
|
const snippet = `bare node: stdlib import - confined; only a wrapping file this repository records as an authorised location may import it: ${request.specifier}`;
|
|
73
|
-
return request.
|
|
74
|
-
|
|
73
|
+
return request.bindings.map((binding) => ({
|
|
74
|
+
check: binding.address,
|
|
75
75
|
anchor: request.anchor,
|
|
76
76
|
snippet,
|
|
77
77
|
importSpecifier: request.specifier
|
|
78
78
|
}));
|
|
79
79
|
};
|
|
80
|
-
var
|
|
81
|
-
outcomes: request.
|
|
82
|
-
const settings =
|
|
80
|
+
var confinedChecksOf = (request) => gatheredOutcomes({
|
|
81
|
+
outcomes: request.bindings.map((binding) => {
|
|
82
|
+
const settings = stringListCheckSettings({ binding, keys: ["confinedOutsideDependencies"] });
|
|
83
83
|
if (settings.outcome === "failed") return settings;
|
|
84
84
|
return {
|
|
85
85
|
outcome: "ok",
|
|
86
|
-
value: [
|
|
86
|
+
value: [
|
|
87
|
+
confinedCheckOf({ binding, packageNames: settings.value.confinedOutsideDependencies })
|
|
88
|
+
]
|
|
87
89
|
};
|
|
88
90
|
})
|
|
89
91
|
});
|
|
90
92
|
var check = {
|
|
91
|
-
prepare: ({
|
|
92
|
-
const settled =
|
|
93
|
+
prepare: ({ bindings, syntaxApi }) => {
|
|
94
|
+
const settled = confinedChecksOf({ bindings });
|
|
93
95
|
if (settled.outcome === "failed") return settled;
|
|
94
96
|
const confined = settled.value;
|
|
95
97
|
return {
|
|
@@ -111,7 +113,7 @@ var check = {
|
|
|
111
113
|
if (imported === void 0) return;
|
|
112
114
|
nodeHits.push(
|
|
113
115
|
...nodeSchemeHits({
|
|
114
|
-
|
|
116
|
+
bindings,
|
|
115
117
|
anchor: anchorAt({ position: imported.position }),
|
|
116
118
|
specifier: imported.specifier
|
|
117
119
|
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"flag": [
|
|
3
|
+
{
|
|
4
|
+
"name": "execution enters the runtime debugger",
|
|
5
|
+
"fileName": "src/reserve.ts",
|
|
6
|
+
"source": "export function reserve() {\n debugger;\n}",
|
|
7
|
+
"expectedLines": [2]
|
|
8
|
+
}
|
|
9
|
+
],
|
|
10
|
+
"allow": [
|
|
11
|
+
{
|
|
12
|
+
"name": "a data property does not pause execution",
|
|
13
|
+
"fileName": "src/reserve.ts",
|
|
14
|
+
"source": "export const options = { debugger: false };",
|
|
15
|
+
"expectedLines": []
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
syntaxNodeCheck
|
|
3
|
+
} from "../../../../../../chunks/chunk-LEFM7OPS.js";
|
|
4
|
+
import "../../../../../../chunks/chunk-5AKHEW6V.js";
|
|
5
|
+
import {
|
|
6
|
+
typeScriptSourceEligibility
|
|
7
|
+
} from "../../../../../../chunks/chunk-COQMPHWZ.js";
|
|
8
|
+
import "../../../../../../chunks/chunk-DGOLOS5A.js";
|
|
9
|
+
|
|
10
|
+
// src/infrastructure/engines/walker/process-global-used-in-place/debugger-statement/debugger-statement.ts
|
|
11
|
+
var check = syntaxNodeCheck({
|
|
12
|
+
eligibility: typeScriptSourceEligibility,
|
|
13
|
+
found: ({ syntaxApi, node }) => syntaxApi.isDebuggerStatement(node) ? { at: node, snippet: "debugger" } : void 0
|
|
14
|
+
});
|
|
15
|
+
export {
|
|
16
|
+
check
|
|
17
|
+
};
|