@hailstails/hone 2.0.0-pre.4 → 2.0.0-pre.5
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 +4 -15
- package/CHANGELOG.md +34 -0
- package/MIGRATING.md +6 -6
- package/README.md +3 -4
- package/chunks/{chunk-FPIP7JEC.js → chunk-4AJQHZ7I.js} +1 -1
- package/chunks/{chunk-CXM5KBZX.js → chunk-6LTJRJOE.js} +1 -1
- package/chunks/{chunk-PVSC4SE3.js → chunk-BISP2JOL.js} +4 -6
- package/chunks/{chunk-YGMO5Z6U.js → chunk-EFUWHLZK.js} +187 -193
- package/chunks/{chunk-BRANVR7K.js → chunk-FRE5IA3C.js} +1 -1
- package/chunks/{chunk-E4D5WDRX.js → chunk-GMLT3MHO.js} +252 -254
- package/chunks/chunk-M4VSJ27S.js +139 -0
- package/chunks/chunk-ND3EOGDK.js +2350 -0
- package/chunks/chunk-ONDBACCR.js +14332 -0
- package/chunks/{chunk-LD766VWU.js → chunk-U6W65ZOF.js} +31 -2
- package/chunks/{chunk-BKQ3K766.js → chunk-WPEOCLTP.js} +39 -33
- package/chunks/{chunk-A3RL4O5V.js → chunk-XNIXPQQ5.js} +35 -2
- package/docs/extending.md +2 -2
- package/methods/lenses/function-first.md +2 -2
- package/package.json +1 -1
- package/rules/README.md +5 -3
- package/rules/SPIRIT.md +1 -1
- package/rules/numbers.md +4 -4
- package/rules/principles/no-leak-across-a-boundary.md +1 -1
- package/rules/principles.md +1 -1
- package/rules/record-kinds/authorised-location.md +1 -1
- package/rules/records.md +11 -19
- package/rules/rules.md +5 -5
- package/rules/sources.md +6 -7
- package/rules/typescript/checks.md +55 -387
- package/rules/typescript/recipes/adapter-per-outside-party.md +10 -5
- package/rules/typescript/recipes/assert-to-narrow.md +114 -4
- package/rules/typescript/recipes/closure-factory.md +5 -5
- package/rules/typescript/recipes/companion-test-file.md +5 -3
- package/rules/typescript/recipes/composed-orchestrator.md +6 -4
- package/rules/typescript/recipes/composition-root.md +5 -3
- package/rules/typescript/recipes/{bounded-context-generic.md → constrained-context-generic.md} +6 -4
- package/rules/typescript/recipes/copy-never-write-in.md +6 -4
- package/rules/typescript/recipes/declared-not-bundled.md +5 -3
- package/rules/typescript/recipes/dependency-record.md +5 -3
- package/rules/typescript/recipes/domain-vocabulary-list.md +5 -3
- package/rules/typescript/recipes/entity-module.md +8 -5
- package/rules/typescript/recipes/exact-pins-and-a-lock-file.md +5 -3
- package/rules/typescript/recipes/extension-outside-the-vendored-code.md +5 -3
- package/rules/typescript/recipes/failure-asserted-as-a-value.md +44 -4
- package/rules/typescript/recipes/failure-mapping-at-the-adapter.md +8 -5
- package/rules/typescript/recipes/fix-the-declaration-not-the-value.md +5 -3
- package/rules/typescript/recipes/functional-iteration.md +8 -3
- package/rules/typescript/recipes/guard-clauses.md +5 -3
- package/rules/typescript/recipes/integration-test-owns-its-scratch.md +5 -3
- package/rules/typescript/recipes/integration-test-suffix.md +5 -3
- package/rules/typescript/recipes/it-each-over-typed-rows.md +117 -0
- package/rules/typescript/recipes/map-out-at-the-adapter.md +36 -4
- package/rules/typescript/recipes/meaning-in-names-not-comments.md +5 -5
- package/rules/typescript/recipes/named-exported-type.md +5 -3
- package/rules/typescript/recipes/narrow-ports.md +5 -3
- package/rules/typescript/recipes/one-argument-object.md +8 -3
- package/rules/typescript/recipes/{port-in-the-domain.md → port-in-a-module-of-its-own.md} +7 -5
- package/rules/typescript/recipes/ports-in-the-argument.md +5 -3
- package/rules/typescript/recipes/repo-scripts-only.md +5 -3
- package/rules/typescript/recipes/result-union.md +5 -5
- package/rules/typescript/recipes/screaming-folders.md +5 -5
- package/rules/typescript/recipes/shared-strict-base-config.md +5 -5
- package/rules/typescript/recipes/stub-with-vi-fn.md +130 -0
- package/rules/typescript/recipes/tagged-union-and-exhaustive-switch.md +5 -3
- package/rules/typescript/recipes/whole-words.md +5 -3
- package/rules/typescript/recipes/whole-written-out-expectation.md +284 -4
- package/rules/typescript/recipes/world-values-through-a-port.md +5 -3
- package/rules/typescript/recipes/zod-at-the-producers-adapter.md +8 -3
- package/rules/typescript/recipes.md +567 -21
- package/rules/typescript/symptoms/ambient-randomness.md +1 -1
- package/rules/typescript/symptoms/answer-set-in-a-hook.md +1 -1
- package/rules/typescript/symptoms/{assertion-outside-a-test → assertion-outside-a-test-body}/assertion-site.md +1 -1
- package/rules/typescript/symptoms/{assertion-outside-a-test.md → assertion-outside-a-test-body.md} +1 -1
- package/rules/typescript/symptoms/branch-in-a-test/test-body.md +10 -184
- package/rules/typescript/symptoms/branch-in-a-test.md +11 -1
- package/rules/typescript/symptoms/claimed-type/non-null-assertions.md +1 -1
- package/rules/typescript/symptoms/{code-or-prose-read-as-text.md → code-or-prose-read-as-text-in-a-test.md} +2 -2
- package/rules/typescript/symptoms/computed-value-in-a-test/test-body.md +26 -117
- package/rules/typescript/symptoms/computed-value-in-a-test.md +1 -1
- package/rules/typescript/symptoms/date-used-directly.md +1 -1
- package/rules/typescript/symptoms/default-for-a-required-value.md +1 -1
- package/rules/typescript/symptoms/double-with-a-body/logic-in-a-passed-function.md +1 -18
- package/rules/typescript/symptoms/double-with-a-body.md +1 -1
- package/rules/typescript/symptoms/{export-from-a-test-file.md → export-from-a-test.md} +1 -1
- package/rules/typescript/symptoms/failure-shaped-as-success.md +1 -1
- package/rules/typescript/symptoms/inherited-environment-in-a-subprocess/git-spawn-environment.md +1 -1
- package/rules/typescript/symptoms/inner-layer-imports-outer.md +1 -1
- package/rules/typescript/symptoms/library-class-built-in-place.md +1 -1
- package/rules/typescript/symptoms/loop-keyword/loop-statement.md +1 -1
- package/rules/typescript/symptoms/outside-import-past-a-boundary/import-or-require.md +1 -0
- package/rules/typescript/symptoms/outside-import-past-a-boundary.md +5 -4
- package/rules/typescript/symptoms/outside-type-in-a-signature.md +2 -2
- package/rules/typescript/symptoms/{port-outside-the-domain.md → port-beside-its-adapter.md} +2 -2
- package/rules/typescript/symptoms/port-named-for-a-mechanism.md +1 -1
- package/rules/typescript/symptoms/process-global-used-in-place.md +1 -1
- package/rules/typescript/symptoms/rebinding/test-body.md +1 -18
- package/rules/typescript/symptoms/rebinding.md +11 -1
- package/rules/typescript/symptoms/schema-past-its-adapter.md +2 -2
- package/rules/typescript/symptoms/text-past-its-reader/test-body.md +2 -17
- package/rules/typescript/symptoms/text-past-its-reader.md +1 -1
- package/rules/typescript/symptoms/throw-or-catch-in-a-test/try-block.md +1 -25
- package/rules/typescript/symptoms/type-declared-in-a-test/test-type-declaration.md +1 -1
- package/rules/typescript/symptoms/unasserted-call.md +1 -1
- package/rules/typescript/symptoms.md +35 -35
- package/src/domain/language-layer/authored-item-types.d.ts +21 -5
- package/src/domain/runner/runner-result-types.d.ts +1 -2
- package/src/eslint-plugin.js +40 -38
- package/src/hone.js +15 -13638
- package/src/infrastructure/disciplines-file/version-one-names.json +4 -5
- package/src/infrastructure/engines/eslint/runner/runner.js +55 -45
- package/src/infrastructure/engines/walker/{assertion-outside-a-test → assertion-outside-a-test-body}/assertion-site/assertion-site.js +1 -1
- package/src/infrastructure/engines/walker/branch-in-a-test/test-body/test-body-logic.js +39 -65
- package/src/infrastructure/engines/walker/{code-or-prose-read-as-text → code-or-prose-read-as-text-in-a-test}/raw-read/raw-read.js +1 -1
- package/src/infrastructure/engines/walker/{export-from-a-test-file → export-from-a-test}/test-file-export/test-file-export.js +1 -1
- package/src/infrastructure/engines/walker/runner/runner.js +10 -10
- package/src/infrastructure/engines/walker/strictness-weakened/strict/compiler-overrides.js +3 -3
- package/src/infrastructure/engines/walker/type-declared-in-a-test/test-type-declaration/test-type-declaration.examples.json +15 -3
- package/src/infrastructure/engines/walker/type-declared-in-a-test/test-type-declaration/test-type-declaration.js +118 -4
- package/src/measure-engines.process.js +80 -0
- package/src/testing.js +81 -9
- package/chunks/chunk-7FVSZ2VL.js +0 -1304
- package/chunks/chunk-BIDD2YWP.js +0 -398
- package/rules/record-kinds/boundary-record.md +0 -9
- package/rules/typescript/recipes/iteach-over-typed-rows.md +0 -18
- package/rules/typescript/recipes/stub-with-vifn.md +0 -20
- /package/rules/typescript/symptoms/{code-or-prose-read-as-text → code-or-prose-read-as-text-in-a-test}/raw-read.md +0 -0
- /package/rules/typescript/symptoms/{export-from-a-test-file → export-from-a-test}/test-file-export.md +0 -0
- /package/src/infrastructure/engines/walker/{assertion-outside-a-test → assertion-outside-a-test-body}/assertion-site/assertion-site.examples.json +0 -0
- /package/src/infrastructure/engines/walker/{assertion-outside-a-test → assertion-outside-a-test-body}/assertion-site/piece.json +0 -0
- /package/src/infrastructure/engines/walker/{code-or-prose-read-as-text → code-or-prose-read-as-text-in-a-test}/raw-read/piece.json +0 -0
- /package/src/infrastructure/engines/walker/{code-or-prose-read-as-text → code-or-prose-read-as-text-in-a-test}/raw-read/raw-read.examples.json +0 -0
- /package/src/infrastructure/engines/walker/{export-from-a-test-file → export-from-a-test}/test-file-export/piece.json +0 -0
- /package/src/infrastructure/engines/walker/{export-from-a-test-file → export-from-a-test}/test-file-export/test-file-export.examples.json +0 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ownedNameText
|
|
3
|
+
} from "./chunk-4AJQHZ7I.js";
|
|
4
|
+
import {
|
|
5
|
+
checkAddressTextOf
|
|
6
|
+
} from "./chunk-WPEOCLTP.js";
|
|
7
|
+
|
|
8
|
+
// src/domain/repository/exclusion.ts
|
|
9
|
+
var exclusionOf = (request) => request.excluded.some(
|
|
10
|
+
(excludedPath) => request.path === excludedPath || request.path.startsWith(`${excludedPath}/`)
|
|
11
|
+
) ? "excluded" : "checked";
|
|
12
|
+
|
|
13
|
+
// src/domain/records/answering/records-by-place.ts
|
|
14
|
+
var symptomKey = (request) => `symptom:${ownedNameText(request.symptom)}`;
|
|
15
|
+
var addressKey = (request) => `check:${ownedNameText(request.address)}`;
|
|
16
|
+
var checkKey = (request) => addressKey({
|
|
17
|
+
address: {
|
|
18
|
+
ruleSet: request.symptom.ruleSet,
|
|
19
|
+
name: checkAddressTextOf({ check: { name: request.check, symptom: request.symptom } })
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
var answeredByPlaceOf = (request) => new Map(
|
|
23
|
+
[...Map.groupBy(request.answered, ({ file }) => file)].map(([file, answers]) => [
|
|
24
|
+
file,
|
|
25
|
+
new Set(
|
|
26
|
+
answers.map(
|
|
27
|
+
({ ruleSet, symptom, check }) => check === void 0 ? symptomKey({ symptom: { ruleSet, name: symptom } }) : checkKey({ symptom: { ruleSet, name: symptom }, check })
|
|
28
|
+
)
|
|
29
|
+
)
|
|
30
|
+
])
|
|
31
|
+
);
|
|
32
|
+
var answeredAt = (request) => {
|
|
33
|
+
const answers = request.byPlace.get(request.file);
|
|
34
|
+
const { ruleSet } = request;
|
|
35
|
+
return answers !== void 0 && (answers.has(symptomKey({ symptom: { ruleSet, name: request.symptom } })) || answers.has(addressKey({ address: { ruleSet, name: request.address } }))) ? "holds" : "does-not-hold";
|
|
36
|
+
};
|
|
37
|
+
var recipeKey = (request) => `recipe:${ownedNameText(request.recipe)}`;
|
|
38
|
+
var symptomReachKeysOf = (request) => {
|
|
39
|
+
const { symptom, reach } = request;
|
|
40
|
+
switch (reach.reaches) {
|
|
41
|
+
case "whole-symptom":
|
|
42
|
+
return [symptomKey({ symptom })];
|
|
43
|
+
case "one-check":
|
|
44
|
+
return [checkKey({ symptom, check: reach.check.name })];
|
|
45
|
+
case "unknown-check":
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var reachKeysOf = (request) => {
|
|
50
|
+
const { record } = request;
|
|
51
|
+
switch (record.kind) {
|
|
52
|
+
case "debt":
|
|
53
|
+
case "authorised-location":
|
|
54
|
+
return symptomReachKeysOf({ symptom: record.symptom, reach: record.reach });
|
|
55
|
+
case "deviation":
|
|
56
|
+
return [recipeKey({ recipe: record.recipe })];
|
|
57
|
+
case "dependency-record":
|
|
58
|
+
return [];
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var keyedOf = (request) => reachKeysOf({ record: request.placed.record }).map((key) => ({
|
|
62
|
+
placed: request.placed,
|
|
63
|
+
rank: request.rank,
|
|
64
|
+
path: request.path,
|
|
65
|
+
key
|
|
66
|
+
}));
|
|
67
|
+
var byPathAndKey = (request) => new Map(
|
|
68
|
+
[...Map.groupBy(request.keyed, ({ path }) => path)].map(([path, entries]) => [
|
|
69
|
+
path,
|
|
70
|
+
Map.groupBy(entries, ({ key }) => key)
|
|
71
|
+
])
|
|
72
|
+
);
|
|
73
|
+
var recordsByPlaceOf = (request) => {
|
|
74
|
+
const inFile = request.records.flatMap((placed, rank) => {
|
|
75
|
+
const { record } = placed;
|
|
76
|
+
return record.kind === "debt" || record.kind === "authorised-location" || record.kind === "deviation" ? keyedOf({ placed, rank, path: record.file }) : [];
|
|
77
|
+
});
|
|
78
|
+
return {
|
|
79
|
+
ranks: new Map(request.records.map((placed, rank) => [placed, rank])),
|
|
80
|
+
inFile: byPathAndKey({ keyed: inFile })
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
var rankEntry = (request) => [
|
|
84
|
+
request.placed,
|
|
85
|
+
request.rank
|
|
86
|
+
];
|
|
87
|
+
var inRankOrder = (request) => [...request.ranked].toSorted(([, left], [, right]) => left - right).map(([placed]) => placed);
|
|
88
|
+
var placedInRecordOrder = (request) => inRankOrder({
|
|
89
|
+
ranked: new Map(
|
|
90
|
+
[...request.records].flatMap((placed) => {
|
|
91
|
+
const rank = request.byPlace.ranks.get(placed);
|
|
92
|
+
return rank === void 0 ? [] : [rankEntry({ placed, rank })];
|
|
93
|
+
})
|
|
94
|
+
)
|
|
95
|
+
});
|
|
96
|
+
var siteKeysOf = (request) => {
|
|
97
|
+
const { symptom, check, recipes } = request.site;
|
|
98
|
+
return [
|
|
99
|
+
symptomKey({ symptom }),
|
|
100
|
+
...check.found === "check" ? [checkKey({ symptom, check: check.check.name })] : [],
|
|
101
|
+
...recipes.map((recipe) => recipeKey({ recipe }))
|
|
102
|
+
];
|
|
103
|
+
};
|
|
104
|
+
var rankedAt = (request) => {
|
|
105
|
+
const byKey = request.byPath.get(request.path);
|
|
106
|
+
return byKey === void 0 ? [] : request.keys.flatMap((key) => byKey.get(key) ?? []);
|
|
107
|
+
};
|
|
108
|
+
var recordsReachingSites = (request) => inRankOrder({
|
|
109
|
+
ranked: new Map(
|
|
110
|
+
request.sites.flatMap((site) => {
|
|
111
|
+
const keys = siteKeysOf({ site });
|
|
112
|
+
return rankedAt({ byPath: request.byPlace.inFile, path: site.file, keys }).map(rankEntry);
|
|
113
|
+
})
|
|
114
|
+
)
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
// src/infrastructure/engines/eslint/eslint-config-lookup.ts
|
|
118
|
+
import { z } from "zod";
|
|
119
|
+
var eslintConfigLookupSchema = z.enum(["nearest-to-file", "repository-root"]);
|
|
120
|
+
|
|
121
|
+
// src/domain/repository/absolute-within.ts
|
|
122
|
+
var BACKSLASH = "\\";
|
|
123
|
+
var BACKSLASH_FORM = /^(?:[A-Za-z]:\\|\\\\)/;
|
|
124
|
+
var absoluteWithin = (request) => {
|
|
125
|
+
const separator = BACKSLASH_FORM.test(request.root) ? BACKSLASH : "/";
|
|
126
|
+
const root = request.root.endsWith(separator) ? request.root.slice(0, -1) : request.root;
|
|
127
|
+
return `${root}${separator}${request.file.replaceAll("/", separator)}`;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export {
|
|
131
|
+
exclusionOf,
|
|
132
|
+
answeredByPlaceOf,
|
|
133
|
+
answeredAt,
|
|
134
|
+
recordsByPlaceOf,
|
|
135
|
+
placedInRecordOrder,
|
|
136
|
+
recordsReachingSites,
|
|
137
|
+
eslintConfigLookupSchema,
|
|
138
|
+
absoluteWithin
|
|
139
|
+
};
|