@nielspeter/eess 0.2.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +97 -4
- package/dist/assertion-advice.d.ts +26 -0
- package/dist/assertion-advice.d.ts.map +1 -0
- package/dist/assertion-advice.js +29 -0
- package/dist/assertion-advice.js.map +1 -0
- package/dist/baseline-generator.d.ts +9 -0
- package/dist/baseline-generator.d.ts.map +1 -1
- package/dist/baseline-generator.js +9 -0
- package/dist/baseline-generator.js.map +1 -1
- package/dist/baseline.d.ts +69 -4
- package/dist/baseline.d.ts.map +1 -1
- package/dist/baseline.js +119 -13
- package/dist/baseline.js.map +1 -1
- package/dist/cache-registry.d.ts +14 -0
- package/dist/cache-registry.d.ts.map +1 -0
- package/dist/cache-registry.js +37 -0
- package/dist/cache-registry.js.map +1 -0
- package/dist/cardinality.d.ts +35 -0
- package/dist/cardinality.d.ts.map +1 -0
- package/dist/cardinality.js +80 -0
- package/dist/cardinality.js.map +1 -0
- package/dist/check-options.d.ts +14 -0
- package/dist/check-options.d.ts.map +1 -1
- package/dist/cli-config.d.ts +59 -0
- package/dist/cli-config.d.ts.map +1 -0
- package/dist/cli-config.js +84 -0
- package/dist/cli-config.js.map +1 -0
- package/dist/collect-result.d.ts +94 -0
- package/dist/collect-result.d.ts.map +1 -0
- package/dist/collect-result.js +142 -0
- package/dist/collect-result.js.map +1 -0
- package/dist/combinators.d.ts +14 -0
- package/dist/combinators.d.ts.map +1 -1
- package/dist/combinators.js +53 -16
- package/dist/combinators.js.map +1 -1
- package/dist/comment-suppression.d.ts +60 -0
- package/dist/comment-suppression.d.ts.map +1 -0
- package/dist/comment-suppression.js +89 -0
- package/dist/comment-suppression.js.map +1 -0
- package/dist/condition.d.ts +43 -0
- package/dist/condition.d.ts.map +1 -1
- package/dist/condition.js +48 -1
- package/dist/condition.js.map +1 -1
- package/dist/correspondence-core.d.ts +35 -0
- package/dist/correspondence-core.d.ts.map +1 -0
- package/dist/correspondence-core.js +38 -0
- package/dist/correspondence-core.js.map +1 -0
- package/dist/correspondence.d.ts +57 -5
- package/dist/correspondence.d.ts.map +1 -1
- package/dist/correspondence.js +74 -5
- package/dist/correspondence.js.map +1 -1
- package/dist/dedupe-config-findings.d.ts +56 -0
- package/dist/dedupe-config-findings.d.ts.map +1 -0
- package/dist/dedupe-config-findings.js +101 -0
- package/dist/dedupe-config-findings.js.map +1 -0
- package/dist/define.d.ts +44 -2
- package/dist/define.d.ts.map +1 -1
- package/dist/define.js +45 -4
- package/dist/define.js.map +1 -1
- package/dist/diff-aware.d.ts +8 -1
- package/dist/diff-aware.d.ts.map +1 -1
- package/dist/diff-aware.js +39 -9
- package/dist/diff-aware.js.map +1 -1
- package/dist/diff-disclosure.d.ts +72 -0
- package/dist/diff-disclosure.d.ts.map +1 -0
- package/dist/diff-disclosure.js +110 -0
- package/dist/diff-disclosure.js.map +1 -0
- package/dist/disk-set.d.ts +27 -0
- package/dist/disk-set.d.ts.map +1 -0
- package/dist/disk-set.js +12 -0
- package/dist/disk-set.js.map +1 -0
- package/dist/edge-coverage.d.ts +96 -0
- package/dist/edge-coverage.d.ts.map +1 -0
- package/dist/edge-coverage.js +108 -0
- package/dist/edge-coverage.js.map +1 -0
- package/dist/emitter-findings.d.ts +167 -0
- package/dist/emitter-findings.d.ts.map +1 -0
- package/dist/emitter-findings.js +237 -0
- package/dist/emitter-findings.js.map +1 -0
- package/dist/errors.d.ts +73 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +93 -0
- package/dist/errors.js.map +1 -1
- package/dist/exclusion-comments.d.ts +36 -1
- package/dist/exclusion-comments.d.ts.map +1 -1
- package/dist/exclusion-comments.js +185 -37
- package/dist/exclusion-comments.js.map +1 -1
- package/dist/execute-rule.d.ts +11 -1
- package/dist/execute-rule.d.ts.map +1 -1
- package/dist/execute-rule.js +220 -11
- package/dist/execute-rule.js.map +1 -1
- package/dist/file-walk.d.ts +22 -0
- package/dist/file-walk.d.ts.map +1 -0
- package/dist/file-walk.js +51 -0
- package/dist/file-walk.js.map +1 -0
- package/dist/format-github.d.ts.map +1 -1
- package/dist/format-github.js +37 -5
- package/dist/format-github.js.map +1 -1
- package/dist/format-json.d.ts +96 -1
- package/dist/format-json.d.ts.map +1 -1
- package/dist/format-json.js +94 -9
- package/dist/format-json.js.map +1 -1
- package/dist/format.d.ts +4 -2
- package/dist/format.d.ts.map +1 -1
- package/dist/format.js +41 -19
- package/dist/format.js.map +1 -1
- package/dist/glob-site.d.ts +232 -0
- package/dist/glob-site.d.ts.map +1 -0
- package/dist/glob-site.js +156 -0
- package/dist/glob-site.js.map +1 -0
- package/dist/identity-root.d.ts +55 -0
- package/dist/identity-root.d.ts.map +1 -0
- package/dist/identity-root.js +170 -0
- package/dist/identity-root.js.map +1 -0
- package/dist/index.d.ts +18 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -10
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +55 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +92 -0
- package/dist/internal.js.map +1 -0
- package/dist/mask-non-comment.d.ts +49 -0
- package/dist/mask-non-comment.d.ts.map +1 -0
- package/dist/mask-non-comment.js +261 -0
- package/dist/mask-non-comment.js.map +1 -0
- package/dist/owns-empty-discovery.d.ts +5 -0
- package/dist/owns-empty-discovery.d.ts.map +1 -0
- package/dist/owns-empty-discovery.js +85 -0
- package/dist/owns-empty-discovery.js.map +1 -0
- package/dist/path-suffix.d.ts +57 -0
- package/dist/path-suffix.d.ts.map +1 -0
- package/dist/path-suffix.js +73 -0
- package/dist/path-suffix.js.map +1 -0
- package/dist/path-universe.d.ts +44 -0
- package/dist/path-universe.d.ts.map +1 -0
- package/dist/path-universe.js +21 -0
- package/dist/path-universe.js.map +1 -0
- package/dist/predicate.d.ts +45 -0
- package/dist/predicate.d.ts.map +1 -1
- package/dist/predicate.js +20 -1
- package/dist/predicate.js.map +1 -1
- package/dist/preset-dispatch.d.ts +6 -15
- package/dist/preset-dispatch.d.ts.map +1 -1
- package/dist/preset-dispatch.js +35 -17
- package/dist/preset-dispatch.js.map +1 -1
- package/dist/project-relative.d.ts +25 -0
- package/dist/project-relative.d.ts.map +1 -0
- package/dist/project-relative.js +54 -0
- package/dist/project-relative.js.map +1 -0
- package/dist/report.d.ts +42 -12
- package/dist/report.d.ts.map +1 -1
- package/dist/report.js +190 -14
- package/dist/report.js.map +1 -1
- package/dist/rule-builder-like.d.ts +17 -0
- package/dist/rule-builder-like.d.ts.map +1 -0
- package/dist/rule-builder-like.js +2 -0
- package/dist/rule-builder-like.js.map +1 -0
- package/dist/rule-builder.d.ts +124 -84
- package/dist/rule-builder.d.ts.map +1 -1
- package/dist/rule-builder.js +230 -181
- package/dist/rule-builder.js.map +1 -1
- package/dist/rule-description.d.ts +83 -1
- package/dist/rule-description.d.ts.map +1 -1
- package/dist/rule-description.js +75 -1
- package/dist/rule-description.js.map +1 -1
- package/dist/rule-metadata.d.ts +20 -3
- package/dist/rule-metadata.d.ts.map +1 -1
- package/dist/selection-memo.d.ts +45 -0
- package/dist/selection-memo.d.ts.map +1 -0
- package/dist/selection-memo.js +66 -0
- package/dist/selection-memo.js.map +1 -0
- package/dist/shallow-clone.d.ts +20 -0
- package/dist/shallow-clone.d.ts.map +1 -0
- package/dist/shallow-clone.js +27 -0
- package/dist/shallow-clone.js.map +1 -0
- package/dist/silent-exclusion.d.ts +12 -0
- package/dist/silent-exclusion.d.ts.map +1 -1
- package/dist/silent-exclusion.js +22 -0
- package/dist/silent-exclusion.js.map +1 -1
- package/dist/stderr.d.ts +16 -0
- package/dist/stderr.d.ts.map +1 -0
- package/dist/stderr.js +73 -0
- package/dist/stderr.js.map +1 -0
- package/dist/terminal-builder.d.ts +224 -10
- package/dist/terminal-builder.d.ts.map +1 -1
- package/dist/terminal-builder.js +336 -46
- package/dist/terminal-builder.js.map +1 -1
- package/dist/type-guards.d.ts +38 -0
- package/dist/type-guards.d.ts.map +1 -0
- package/dist/type-guards.js +42 -0
- package/dist/type-guards.js.map +1 -0
- package/dist/unsuppressable.d.ts +54 -0
- package/dist/unsuppressable.d.ts.map +1 -0
- package/dist/unsuppressable.js +76 -0
- package/dist/unsuppressable.js.map +1 -0
- package/dist/vacuity-findings.d.ts +49 -0
- package/dist/vacuity-findings.d.ts.map +1 -0
- package/dist/vacuity-findings.js +94 -0
- package/dist/vacuity-findings.js.map +1 -0
- package/dist/violation.d.ts +173 -4
- package/dist/violation.d.ts.map +1 -1
- package/dist/violation.js +262 -1
- package/dist/violation.js.map +1 -1
- package/dist/watch.d.ts +71 -0
- package/dist/watch.d.ts.map +1 -0
- package/dist/watch.js +129 -0
- package/dist/watch.js.map +1 -0
- package/package.json +6 -1
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { UNSUPPRESSABLE } from './unsuppressable.js';
|
|
2
|
+
/**
|
|
3
|
+
* The emitter's own configuration findings — [ADR-014](../../../adr/014-the-emitter-refuses-a-verdict-without-evidence.md).
|
|
4
|
+
*
|
|
5
|
+
* **Why these are not in `vacuity-findings.ts`.** Every finding there is built by
|
|
6
|
+
* `configFinding(facts, message)`, which reads its `ruleId` from
|
|
7
|
+
* `facts.describeRule()`. At the emitter there is no rule to describe: the value
|
|
8
|
+
* arrived from a preset, a loop, or a hand-assembled array, and the whole point
|
|
9
|
+
* of ADR-014 is that the emitter must speak about values it did not mint.
|
|
10
|
+
*
|
|
11
|
+
* That is not a stylistic difference, it is bug 0190's cause. The kernel's
|
|
12
|
+
* previous preset finding took `(presetName, optionsHint)` and carried **no
|
|
13
|
+
* `ruleId`**, so nothing could assert on it and no non-vacuity fixture could key
|
|
14
|
+
* on it — a finding no test could name is a finding no one can prove fires. It
|
|
15
|
+
* had no call site and was deleted rather than wired (plan 0235 Phase 0). These
|
|
16
|
+
* two carry **hardcoded, stable ids**, and they are the first hardcoded rule ids
|
|
17
|
+
* in the kernel for exactly that reason.
|
|
18
|
+
*
|
|
19
|
+
* **Why two and not one.** ADR-014 §4 separates them, and the remedies differ:
|
|
20
|
+
*
|
|
21
|
+
* - `emitter/no-receipt` — the value carried no evidence field at all. A shape
|
|
22
|
+
* defect. The remedy ("hand over what the pipeline minted") is real on every
|
|
23
|
+
* path, including one where the run was perfectly healthy.
|
|
24
|
+
* - `emitter/pass-without-evidence` — the value carried evidence, and it says
|
|
25
|
+
* zero examined with zero violations and no declaration. A vacuous pass. The
|
|
26
|
+
* remedy is about the selection, not the shape.
|
|
27
|
+
*
|
|
28
|
+
* Folding them into one id would make the fixture for either satisfiable by the
|
|
29
|
+
* other, which is the discrimination failure `check:nonvacuity` exists to catch.
|
|
30
|
+
*
|
|
31
|
+
* **What the kernel may say.** ADR-014 §4 is explicit that the kernel "never
|
|
32
|
+
* names a preset's options at a seam that may not be a preset": a preset that
|
|
33
|
+
* constructed zero rules owns its own remedy and names it before handing over.
|
|
34
|
+
* So these messages speak only about the value and the loop that produced it —
|
|
35
|
+
* the vocabulary any hand-assembler can act on.
|
|
36
|
+
*
|
|
37
|
+
* **`expectEmpty` is not an exception to that, it is the reason for the rule's
|
|
38
|
+
* shape.** It lives on the KERNEL's own `PresetReportOptions`, so naming it
|
|
39
|
+
* names this package's surface rather than a dialect's — and a product review
|
|
40
|
+
* found the vacuous-pass message, the one most likely to red an adopter's
|
|
41
|
+
* build, told them to "declare the set legitimately empty" without saying how.
|
|
42
|
+
* A remedy an author cannot act on is ADR-009 rule 2's failure, and it sends
|
|
43
|
+
* them to the one escape the message forbids in its next clause.
|
|
44
|
+
*/
|
|
45
|
+
/** The value handed to an emitter carried no evidence field at all. */
|
|
46
|
+
export const EMITTER_NO_RECEIPT = 'emitter/no-receipt';
|
|
47
|
+
/** Zero examined, zero violations, no declaration — a pass built from nothing. */
|
|
48
|
+
export const EMITTER_PASS_WITHOUT_EVIDENCE = 'emitter/pass-without-evidence';
|
|
49
|
+
/**
|
|
50
|
+
* A declaration that has expired: declared empty, then examined something.
|
|
51
|
+
*
|
|
52
|
+
* **This is what makes a declaration legitimate at all.** ADR-010 §3 admits
|
|
53
|
+
* `.expectEmpty()` precisely because it "fails the day it stops being true" —
|
|
54
|
+
* a claim that can never be contradicted is not an assertion, and the whole
|
|
55
|
+
* 2026-09-05 amendment to ADR-014 §3 turns on that property. Without this
|
|
56
|
+
* finding the emitter would accept a declaration nothing can ever falsify,
|
|
57
|
+
* which is the shape that amendment refused for `overrides: 'off'`.
|
|
58
|
+
*/
|
|
59
|
+
export const EMITTER_EXPIRED_DECLARATION = 'emitter/expired-declaration';
|
|
60
|
+
/**
|
|
61
|
+
* A receipt that claims it never ran, and carries evidence that it did.
|
|
62
|
+
*
|
|
63
|
+
* **The falsifier `notRun` was shipped without.** `declaredEmpty` has one — the
|
|
64
|
+
* expiry above — and that property is the entire reason ADR-010 §3 admits a
|
|
65
|
+
* declaration at all. `notRun` suppresses too: it is the one condition that
|
|
66
|
+
* excludes a member from `mergeCollectResults`'s dead-member filter, so a zero
|
|
67
|
+
* marked `notRun` is a zero the merge will not complain about. A suppressor with
|
|
68
|
+
* no contradiction is exactly the shape ADR-014 §3's amendment refuses, and
|
|
69
|
+
* shipping one inside the change that establishes the rule is the defect an
|
|
70
|
+
* enforcement review caught here.
|
|
71
|
+
*
|
|
72
|
+
* A rule that never ran examined nothing and found nothing. Both halves are
|
|
73
|
+
* checked, because either alone is a lie the other does not cover: `examined > 0`
|
|
74
|
+
* is a denominator that could not exist, and a violation is a finding that could
|
|
75
|
+
* not have been produced.
|
|
76
|
+
*/
|
|
77
|
+
export const EMITTER_CONTRADICTORY_EVIDENCE = 'emitter/contradictory-evidence';
|
|
78
|
+
/**
|
|
79
|
+
* The verdict's own source loaded nothing — ADR-014 §4.
|
|
80
|
+
*
|
|
81
|
+
* Distinct from `emitter/pass-without-evidence`, and the distinction is the
|
|
82
|
+
* point: a zero-examined verdict *may* be legitimate if the caller declares the
|
|
83
|
+
* emptiness, but an empty SOURCE may not. §4 states the precedence — "an empty
|
|
84
|
+
* source (`sourceEmpty`) outranks any declaration and names the source" — and
|
|
85
|
+
* ADR-010 §3 carries the same rule at the terminal as a `gated` row.
|
|
86
|
+
*
|
|
87
|
+
* The gate honoured `declaredEmpty` before it ever looked at `sourceEmpty`, so a
|
|
88
|
+
* hand-assembled receipt setting both passed silently: the escape hatch the
|
|
89
|
+
* comment beside that branch said this ADR had closed. Measured before the fix,
|
|
90
|
+
* `finishPreset(collectResult([], { examined: 0, sourceEmpty: true, declaredEmpty: true }))`
|
|
91
|
+
* returned green.
|
|
92
|
+
*/
|
|
93
|
+
export const EMITTER_SOURCE_EMPTY = 'emitter/source-empty';
|
|
94
|
+
/**
|
|
95
|
+
* Every id this module can produce.
|
|
96
|
+
*
|
|
97
|
+
* One list, because there were two: `report.ts` had a four-way `||` and
|
|
98
|
+
* `dedupe-config-findings.ts` grew a second `Set` of the same four. Both are
|
|
99
|
+
* private, neither knew about the other, and a fifth id added to one and not the
|
|
100
|
+
* other silently reintroduces the defect the second was written to fix — N
|
|
101
|
+
* distinct dead builders collapsing into one finding annotated "they are one
|
|
102
|
+
* edit". The argument for naming the constants rather than testing an `emitter/`
|
|
103
|
+
* prefix only holds if there is ONE place to add the next one.
|
|
104
|
+
*
|
|
105
|
+
* Internal: exported for the kernel's own consumers, not on the root surface.
|
|
106
|
+
*/
|
|
107
|
+
export const EMITTER_IDS = new Set([
|
|
108
|
+
EMITTER_NO_RECEIPT,
|
|
109
|
+
EMITTER_PASS_WITHOUT_EVIDENCE,
|
|
110
|
+
EMITTER_EXPIRED_DECLARATION,
|
|
111
|
+
EMITTER_CONTRADICTORY_EVIDENCE,
|
|
112
|
+
EMITTER_SOURCE_EMPTY,
|
|
113
|
+
]);
|
|
114
|
+
/** Is this one of the emitter's own findings, as opposed to a caller's? */
|
|
115
|
+
export function isEmitterFinding(violation) {
|
|
116
|
+
return EMITTER_IDS.has(violation.ruleId ?? violation.rule ?? '');
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Shared shape. `file: ''` / `line: 0` for the same reason `vacuity-findings.ts`
|
|
120
|
+
* uses them: the fault is the verdict, not a place in anyone's code.
|
|
121
|
+
* `bypassFilters` because a suppression mechanism that can suppress the
|
|
122
|
+
* complaint about itself is not a mechanism.
|
|
123
|
+
*/
|
|
124
|
+
function emitterFinding(ruleId, message) {
|
|
125
|
+
return {
|
|
126
|
+
rule: ruleId,
|
|
127
|
+
ruleId,
|
|
128
|
+
element: ruleId,
|
|
129
|
+
file: '',
|
|
130
|
+
line: 0,
|
|
131
|
+
message,
|
|
132
|
+
suggestion: `${message} ${UNSUPPRESSABLE}`,
|
|
133
|
+
bypassFilters: true,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* The source loaded nothing, so no declaration can rescue the verdict.
|
|
138
|
+
*
|
|
139
|
+
* Names the SOURCE, per ADR-014 §4, and says so explicitly — the remedy is to
|
|
140
|
+
* fix the project or glob, never to declare the emptiness, and a reader told to
|
|
141
|
+
* "declare it" here would be sent to the one thing that cannot work. The
|
|
142
|
+
* terminal's `zeroLoadedSourceViolation` says the same thing in the same words;
|
|
143
|
+
* this is its emitter-seam sibling, for a receipt with no rule facts to carry.
|
|
144
|
+
*/
|
|
145
|
+
export function sourceEmptyViolation() {
|
|
146
|
+
return emitterFinding(EMITTER_SOURCE_EMPTY, 'this verdict reports success over a source that loaded zero units before any ' +
|
|
147
|
+
'selection ran — an empty project, an unreadable config, or a glob resolving to ' +
|
|
148
|
+
'nothing. This outranks any declaration: declaring the emptiness cannot make an ' +
|
|
149
|
+
'absent source into evidence. Fix the source configuration — the project, the ' +
|
|
150
|
+
'tsconfig, or the glob — not the declaration.');
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* A value reached an emitter with no evidence at all — a bare array, or an
|
|
154
|
+
* object with no `examined`.
|
|
155
|
+
*
|
|
156
|
+
* This fires even when the run was healthy and found real violations, because
|
|
157
|
+
* the defect is that the verdict cannot be checked, not that it is wrong. That
|
|
158
|
+
* is deliberate: a shape that *sometimes* carries evidence is a shape nobody can
|
|
159
|
+
* rely on, and the one path where it matters most is the path where the loop
|
|
160
|
+
* examined nothing.
|
|
161
|
+
*/
|
|
162
|
+
export function noReceiptViolation() {
|
|
163
|
+
return emitterFinding(EMITTER_NO_RECEIPT, 'this verdict arrived with no evidence of what was examined, so eess cannot tell a ' +
|
|
164
|
+
'clean run from a loop that never ran. Hand the emitter what the pipeline minted — ' +
|
|
165
|
+
"a builder's violations(), or a preset's result — rather than an array assembled by hand. " +
|
|
166
|
+
// Naming the call, because the audience changed. This message was written
|
|
167
|
+
// for someone calling `finishPreset([])` directly; since plan 0263 Phase 2
|
|
168
|
+
// it is also what a rule-file author meets, and THEIR builder is the thing
|
|
169
|
+
// returning the array — so "hand the emitter a builder's violations()"
|
|
170
|
+
// describes what they already did. The changeset's migration line was the
|
|
171
|
+
// actionable one and lived only in the changelog. `collectResult` and
|
|
172
|
+
// `mergeCollectResults` are kernel root exports, re-exported by the
|
|
173
|
+
// dialects, so naming them costs an adopter no second install.
|
|
174
|
+
'If you are writing the builder: return collectResult(violations, { examined }) ' +
|
|
175
|
+
'instead of a plain array, where `examined` is how many units you actually ' +
|
|
176
|
+
'looked at. If you are combining builders, use mergeCollectResults([...]).');
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* A pass with evidence that proves nothing: zero examined, zero violations, no
|
|
180
|
+
* declaration.
|
|
181
|
+
*
|
|
182
|
+
* The remedy names the selection, never a preset's options — ADR-014 §4.
|
|
183
|
+
*/
|
|
184
|
+
export function passWithoutEvidenceViolation() {
|
|
185
|
+
return emitterFinding(EMITTER_PASS_WITHOUT_EVIDENCE, 'this verdict reports success over zero examined units: the loop reached its ' +
|
|
186
|
+
'assertion no times, so nothing was checked and the pass certifies nothing. Widen ' +
|
|
187
|
+
'the selection, or — if the set is legitimately empty — declare it on the receipt: ' +
|
|
188
|
+
'collectResult(violations, { examined, declaredEmpty: true }), or .expectEmpty() ' +
|
|
189
|
+
'on a builder. The declaration expires the day the subject appears, which is why ' +
|
|
190
|
+
'it is not a mute button. Do not suppress this.');
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* The declaration was true when written and is not true now.
|
|
194
|
+
*
|
|
195
|
+
* The mirror of the terminal's own `expiredExpectEmptyViolation`, at the seam a
|
|
196
|
+
* preset's declaration reaches (ADR-014 §3). The number IS the finding, so it
|
|
197
|
+
* is named.
|
|
198
|
+
*/
|
|
199
|
+
export function expiredDeclarationViolation(examined) {
|
|
200
|
+
return emitterFinding(EMITTER_EXPIRED_DECLARATION, `this verdict was declared empty but examined ${String(examined)} unit(s) — the ` +
|
|
201
|
+
'declaration has expired. If the set legitimately grew past empty, remove the ' +
|
|
202
|
+
'declaration; the violations above (if any) still stand.');
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* `notRun` beside evidence of a run.
|
|
206
|
+
*
|
|
207
|
+
* The mirror of {@link expiredDeclarationViolation} for the third state. The
|
|
208
|
+
* numbers ARE the finding, so both are named: a caller debugging this needs to
|
|
209
|
+
* know which half contradicted the flag.
|
|
210
|
+
*/
|
|
211
|
+
/**
|
|
212
|
+
* A flag that quiets a zero, contradicted by the receipt's own evidence.
|
|
213
|
+
*
|
|
214
|
+
* **The flag is a parameter because the message names it.** It was hardcoded to
|
|
215
|
+
* `notRun`, and once `sourceEmpty` became contradictable too, a receipt claiming
|
|
216
|
+
* an empty source beside real evidence was told to "drop the notRun flag" — a
|
|
217
|
+
* flag nobody had set, and a remedy that cannot be applied. Four reviewers
|
|
218
|
+
* measured that on this branch's own headline scenario. ADR-009 rule 2: the
|
|
219
|
+
* finding names its cause, and the remedy remediates.
|
|
220
|
+
*/
|
|
221
|
+
export function contradictoryEvidenceViolation(examined, violations, flag = 'notRun') {
|
|
222
|
+
const claim = flag === 'notRun'
|
|
223
|
+
? 'is marked as never having run'
|
|
224
|
+
: 'is marked as having loaded no source at all';
|
|
225
|
+
const why = flag === 'notRun'
|
|
226
|
+
? 'a rule that did not run can have neither'
|
|
227
|
+
: 'a source that loaded nothing can yield neither';
|
|
228
|
+
const remedy = flag === 'notRun'
|
|
229
|
+
? 'Drop the notRun flag if the rule ran, or drop the evidence if it did not; ' +
|
|
230
|
+
'notRun exists for a rule turned off, not for one whose result you want quiet.'
|
|
231
|
+
: 'Drop the sourceEmpty flag if the source loaded, or drop the evidence if it did ' +
|
|
232
|
+
'not; sourceEmpty describes an instrument that read nothing, not a result you ' +
|
|
233
|
+
'want quiet.';
|
|
234
|
+
return emitterFinding(EMITTER_CONTRADICTORY_EVIDENCE, `this verdict ${claim}, but examined ${String(examined)} unit(s) ` +
|
|
235
|
+
`and carries ${String(violations)} violation(s) — ${why}. ${remedy}`);
|
|
236
|
+
}
|
|
237
|
+
//# sourceMappingURL=emitter-findings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emitter-findings.js","sourceRoot":"","sources":["../src/emitter-findings.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,uEAAuE;AACvE,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAA;AAEtD,kFAAkF;AAClF,MAAM,CAAC,MAAM,6BAA6B,GAAG,+BAA+B,CAAA;AAE5E;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,6BAA6B,CAAA;AAExE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,gCAAgC,CAAA;AAE9E;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,sBAAsB,CAAA;AAE1D;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,WAAW,GAAwB,IAAI,GAAG,CAAC;IACtD,kBAAkB;IAClB,6BAA6B;IAC7B,2BAA2B;IAC3B,8BAA8B;IAC9B,oBAAoB;CACrB,CAAC,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MAAM,CAAC,QAAQ,CAAC,iBAAiB;QAC/E,+EAA+E;QAC/E,yDAAyD,CAC5D,CAAA;AACH,CAAC;AAED;;;;;;GAMG;AACH;;;;;;;;;GASG;AACH,MAAM,UAAU,8BAA8B,CAC5C,QAAgB,EAChB,UAAkB,EAClB,OAAiC,QAAQ;IAEzC,MAAM,KAAK,GACT,IAAI,KAAK,QAAQ;QACf,CAAC,CAAC,+BAA+B;QACjC,CAAC,CAAC,6CAA6C,CAAA;IACnD,MAAM,GAAG,GACP,IAAI,KAAK,QAAQ;QACf,CAAC,CAAC,0CAA0C;QAC5C,CAAC,CAAC,gDAAgD,CAAA;IACtD,MAAM,MAAM,GACV,IAAI,KAAK,QAAQ;QACf,CAAC,CAAC,4EAA4E;YAC5E,+EAA+E;QACjF,CAAC,CAAC,iFAAiF;YACjF,+EAA+E;YAC/E,aAAa,CAAA;IACnB,OAAO,cAAc,CACnB,8BAA8B,EAC9B,gBAAgB,KAAK,kBAAkB,MAAM,CAAC,QAAQ,CAAC,WAAW;QAChE,eAAe,MAAM,CAAC,UAAU,CAAC,mBAAmB,GAAG,KAAK,MAAM,EAAE,CACvE,CAAA;AACH,CAAC"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -11,4 +11,77 @@ export declare class ArchRuleError extends Error {
|
|
|
11
11
|
/** The violations that failed the rule, in report order. */
|
|
12
12
|
get violations(): ArchViolation[];
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Is this an `ArchRuleError` — including one thrown by a DIFFERENT copy of this
|
|
16
|
+
* module?
|
|
17
|
+
*
|
|
18
|
+
* `instanceof` is an identity check, and a rule file does not necessarily load
|
|
19
|
+
* through the same module registry as the CLI that loads it. `load-rules.ts`
|
|
20
|
+
* uses jiti (bug 0074: a `.ts` rule file must load inside a `"type": "commonjs"`
|
|
21
|
+
* consumer project), and jiti keeps its own registry — so the `ArchRuleError`
|
|
22
|
+
* a self-executing rule file throws is a different class object from this one
|
|
23
|
+
* and `instanceof` is FALSE for an error that is, in every way that matters,
|
|
24
|
+
* an ArchRuleError.
|
|
25
|
+
*
|
|
26
|
+
* Measured: that made `check.ts` skip `ruleFileTruncated()`, so a rule file
|
|
27
|
+
* whose first rule threw reported the finding and said nothing about the rules
|
|
28
|
+
* after it that never ran — a silent gap in a red run, which is bug 0029
|
|
29
|
+
* reopened by the loader. The same hazard exists for any consumer with two
|
|
30
|
+
* copies of eess-ts on disk (a nested `node_modules`), where the loader is
|
|
31
|
+
* irrelevant.
|
|
32
|
+
*
|
|
33
|
+
* Structural, therefore: the `name` this class stamps in its constructor plus
|
|
34
|
+
* the `violations` array that is its whole reason to exist. Both are part of the
|
|
35
|
+
* documented public shape (`ArchViolation[]` on a thrown error), so matching on
|
|
36
|
+
* them is matching on the contract rather than on a coincidence.
|
|
37
|
+
*/
|
|
38
|
+
export declare function isArchRuleError(error: unknown): error is ArchRuleError;
|
|
39
|
+
/**
|
|
40
|
+
* Thrown when a RULE is misconfigured — bad arguments to a condition, a
|
|
41
|
+
* malformed rule file — as opposed to {@link ArchRuleError}, which means the
|
|
42
|
+
* architecture under test is wrong.
|
|
43
|
+
*
|
|
44
|
+
* The two are different faults with different audiences and the CLI already
|
|
45
|
+
* wants to tell them apart: `rule-file-findings.ts` branches on
|
|
46
|
+
* `isArchRuleError(error)` and routes everything else into one generic
|
|
47
|
+
* "rule file failed" path. An untyped `Error` therefore arrives with its
|
|
48
|
+
* category erased, and a rule author who mistyped an argument is shown the
|
|
49
|
+
* same surface as an unhandled crash.
|
|
50
|
+
*
|
|
51
|
+
* `subject` names what was misconfigured — the condition, predicate or file —
|
|
52
|
+
* so a caller can render the fault without parsing the message.
|
|
53
|
+
*
|
|
54
|
+
* **Why this class exists at all is worth recording.** eess ships an
|
|
55
|
+
* `agentGuardrails` preset whose `no-generic-errors` rule says a bare `Error`
|
|
56
|
+
* "loses the type/context callers need to handle it". This repo exempted itself
|
|
57
|
+
* from running that preset, on a written rationale that the rule fired on
|
|
58
|
+
* legitimate style. When the preset was finally run here it flagged 17 bare
|
|
59
|
+
* `Error`s, and the rationale did not survive contact: the caller the rule
|
|
60
|
+
* describes is real and lives in this package. Dogfooding produced this type.
|
|
61
|
+
*/
|
|
62
|
+
export declare class ArchConfigError extends Error {
|
|
63
|
+
#private;
|
|
64
|
+
/**
|
|
65
|
+
* `options` forwards `cause`, and that is not decoration. `schema-loader.ts`
|
|
66
|
+
* distinguishes "the `graphql` package is missing" from "it is installed but
|
|
67
|
+
* failed to load", and the second case is only actionable because the
|
|
68
|
+
* underlying error travels with it — a fix whose own comment records that
|
|
69
|
+
* discarding it "used to be reported as 'not installed' too, discarding the
|
|
70
|
+
* one line that would have told the reader what actually happened". A typed
|
|
71
|
+
* error that dropped the cause would undo that.
|
|
72
|
+
*/
|
|
73
|
+
constructor(subject: string, message: string, options?: ErrorOptions);
|
|
74
|
+
/** What was misconfigured — a condition name, a predicate name, a file path. */
|
|
75
|
+
get subject(): string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Is this an `ArchConfigError` — including one thrown by a DIFFERENT copy of
|
|
79
|
+
* this module?
|
|
80
|
+
*
|
|
81
|
+
* Structural for the same reason {@link isArchRuleError} is: jiti and nested
|
|
82
|
+
* `node_modules` both put two copies of this class on disk, and `instanceof`
|
|
83
|
+
* is an identity check. Matches on `name` plus the `subject` accessor that is
|
|
84
|
+
* this class's whole reason to exist.
|
|
85
|
+
*/
|
|
86
|
+
export declare function isArchConfigError(error: unknown): error is ArchConfigError;
|
|
14
87
|
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEnD;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,KAAK;;gBAG1B,UAAU,EAAE,aAAa,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM;IAQxD,4DAA4D;IAC5D,IAAI,UAAU,IAAI,aAAa,EAAE,CAEhC;CACF"}
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEnD;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,KAAK;;gBAG1B,UAAU,EAAE,aAAa,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM;IAQxD,4DAA4D;IAC5D,IAAI,UAAU,IAAI,aAAa,EAAE,CAEhC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAQtE;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,eAAgB,SAAQ,KAAK;;IAGxC;;;;;;;;OAQG;gBACS,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;IAMpE,gFAAgF;IAChF,IAAI,OAAO,IAAI,MAAM,CAEpB;CACF;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAQ1E"}
|
package/dist/errors.js
CHANGED
|
@@ -18,4 +18,97 @@ export class ArchRuleError extends Error {
|
|
|
18
18
|
return this.#violations;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Is this an `ArchRuleError` — including one thrown by a DIFFERENT copy of this
|
|
23
|
+
* module?
|
|
24
|
+
*
|
|
25
|
+
* `instanceof` is an identity check, and a rule file does not necessarily load
|
|
26
|
+
* through the same module registry as the CLI that loads it. `load-rules.ts`
|
|
27
|
+
* uses jiti (bug 0074: a `.ts` rule file must load inside a `"type": "commonjs"`
|
|
28
|
+
* consumer project), and jiti keeps its own registry — so the `ArchRuleError`
|
|
29
|
+
* a self-executing rule file throws is a different class object from this one
|
|
30
|
+
* and `instanceof` is FALSE for an error that is, in every way that matters,
|
|
31
|
+
* an ArchRuleError.
|
|
32
|
+
*
|
|
33
|
+
* Measured: that made `check.ts` skip `ruleFileTruncated()`, so a rule file
|
|
34
|
+
* whose first rule threw reported the finding and said nothing about the rules
|
|
35
|
+
* after it that never ran — a silent gap in a red run, which is bug 0029
|
|
36
|
+
* reopened by the loader. The same hazard exists for any consumer with two
|
|
37
|
+
* copies of eess-ts on disk (a nested `node_modules`), where the loader is
|
|
38
|
+
* irrelevant.
|
|
39
|
+
*
|
|
40
|
+
* Structural, therefore: the `name` this class stamps in its constructor plus
|
|
41
|
+
* the `violations` array that is its whole reason to exist. Both are part of the
|
|
42
|
+
* documented public shape (`ArchViolation[]` on a thrown error), so matching on
|
|
43
|
+
* them is matching on the contract rather than on a coincidence.
|
|
44
|
+
*/
|
|
45
|
+
export function isArchRuleError(error) {
|
|
46
|
+
if (error instanceof ArchRuleError)
|
|
47
|
+
return true;
|
|
48
|
+
return (error instanceof Error &&
|
|
49
|
+
error.name === 'ArchRuleError' &&
|
|
50
|
+
'violations' in error &&
|
|
51
|
+
Array.isArray(error.violations));
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Thrown when a RULE is misconfigured — bad arguments to a condition, a
|
|
55
|
+
* malformed rule file — as opposed to {@link ArchRuleError}, which means the
|
|
56
|
+
* architecture under test is wrong.
|
|
57
|
+
*
|
|
58
|
+
* The two are different faults with different audiences and the CLI already
|
|
59
|
+
* wants to tell them apart: `rule-file-findings.ts` branches on
|
|
60
|
+
* `isArchRuleError(error)` and routes everything else into one generic
|
|
61
|
+
* "rule file failed" path. An untyped `Error` therefore arrives with its
|
|
62
|
+
* category erased, and a rule author who mistyped an argument is shown the
|
|
63
|
+
* same surface as an unhandled crash.
|
|
64
|
+
*
|
|
65
|
+
* `subject` names what was misconfigured — the condition, predicate or file —
|
|
66
|
+
* so a caller can render the fault without parsing the message.
|
|
67
|
+
*
|
|
68
|
+
* **Why this class exists at all is worth recording.** eess ships an
|
|
69
|
+
* `agentGuardrails` preset whose `no-generic-errors` rule says a bare `Error`
|
|
70
|
+
* "loses the type/context callers need to handle it". This repo exempted itself
|
|
71
|
+
* from running that preset, on a written rationale that the rule fired on
|
|
72
|
+
* legitimate style. When the preset was finally run here it flagged 17 bare
|
|
73
|
+
* `Error`s, and the rationale did not survive contact: the caller the rule
|
|
74
|
+
* describes is real and lives in this package. Dogfooding produced this type.
|
|
75
|
+
*/
|
|
76
|
+
export class ArchConfigError extends Error {
|
|
77
|
+
#subject;
|
|
78
|
+
/**
|
|
79
|
+
* `options` forwards `cause`, and that is not decoration. `schema-loader.ts`
|
|
80
|
+
* distinguishes "the `graphql` package is missing" from "it is installed but
|
|
81
|
+
* failed to load", and the second case is only actionable because the
|
|
82
|
+
* underlying error travels with it — a fix whose own comment records that
|
|
83
|
+
* discarding it "used to be reported as 'not installed' too, discarding the
|
|
84
|
+
* one line that would have told the reader what actually happened". A typed
|
|
85
|
+
* error that dropped the cause would undo that.
|
|
86
|
+
*/
|
|
87
|
+
constructor(subject, message, options) {
|
|
88
|
+
super(message, options);
|
|
89
|
+
this.name = 'ArchConfigError';
|
|
90
|
+
this.#subject = subject;
|
|
91
|
+
}
|
|
92
|
+
/** What was misconfigured — a condition name, a predicate name, a file path. */
|
|
93
|
+
get subject() {
|
|
94
|
+
return this.#subject;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Is this an `ArchConfigError` — including one thrown by a DIFFERENT copy of
|
|
99
|
+
* this module?
|
|
100
|
+
*
|
|
101
|
+
* Structural for the same reason {@link isArchRuleError} is: jiti and nested
|
|
102
|
+
* `node_modules` both put two copies of this class on disk, and `instanceof`
|
|
103
|
+
* is an identity check. Matches on `name` plus the `subject` accessor that is
|
|
104
|
+
* this class's whole reason to exist.
|
|
105
|
+
*/
|
|
106
|
+
export function isArchConfigError(error) {
|
|
107
|
+
if (error instanceof ArchConfigError)
|
|
108
|
+
return true;
|
|
109
|
+
return (error instanceof Error &&
|
|
110
|
+
error.name === 'ArchConfigError' &&
|
|
111
|
+
'subject' in error &&
|
|
112
|
+
typeof error.subject === 'string');
|
|
113
|
+
}
|
|
21
114
|
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK;IAC7B,WAAW,CAAiB;IAErC,YAAY,UAA2B,EAAE,MAAe;QACtD,MAAM,OAAO,GAAG,yBAAyB,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,CAAA;QAClH,MAAM,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;QAC/C,KAAK,CAAC,GAAG,OAAO,GAAG,UAAU,EAAE,CAAC,CAAA;QAChC,IAAI,CAAC,IAAI,GAAG,eAAe,CAAA;QAC3B,IAAI,CAAC,WAAW,GAAG,UAAU,CAAA;IAC/B,CAAC;IAED,4DAA4D;IAC5D,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,WAAW,CAAA;IACzB,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK;IAC7B,WAAW,CAAiB;IAErC,YAAY,UAA2B,EAAE,MAAe;QACtD,MAAM,OAAO,GAAG,yBAAyB,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KA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AAK;QACtB,KAAK,CAAC,IAAI,KAAK,iBAAiB;QAChC,SAAS,IAAI,KAAK;QAClB,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,CAClC,CAAA;AACH,CAAC"}
|
|
@@ -26,6 +26,22 @@ export interface ExclusionWarning {
|
|
|
26
26
|
file: string;
|
|
27
27
|
/** Line number */
|
|
28
28
|
line: number;
|
|
29
|
+
/**
|
|
30
|
+
* What kind of fault this is, so a caller can act on it differently.
|
|
31
|
+
*
|
|
32
|
+
* `'undocumented'` — the directive is well-formed but states no reason. It is
|
|
33
|
+
* refused (see the reason-free branches below), and a caller may additionally
|
|
34
|
+
* promote this to a finding so the author is told what to fix rather than
|
|
35
|
+
* shown the unrelated violation their waiver was covering. `eess-ts` does.
|
|
36
|
+
*
|
|
37
|
+
* `'malformed'` — the directive is broken syntax. Also refused, and the
|
|
38
|
+
* original violation is already firing, so a stderr line is the right weight.
|
|
39
|
+
*
|
|
40
|
+
* Added when the two parsers were unified (ADR-012): only `eess-ts`'s copy had
|
|
41
|
+
* it, and its `execute-rule` branches on it. Merging without it would have
|
|
42
|
+
* silently downgraded bug 0039's gate to a stderr line.
|
|
43
|
+
*/
|
|
44
|
+
kind: 'undocumented' | 'malformed';
|
|
29
45
|
}
|
|
30
46
|
/**
|
|
31
47
|
* Result of parsing exclusion comments from a source file.
|
|
@@ -47,6 +63,25 @@ export interface ParseResult {
|
|
|
47
63
|
* <!-- eess-exclude <rule-id>: <reason> --> (markdown / text dialects)
|
|
48
64
|
* <!-- eess-exclude-start <rule-id>: <reason> --> / <!-- eess-exclude-end -->
|
|
49
65
|
*/
|
|
50
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Blanks the spans of a file that are NOT comments, length- and line-preserving
|
|
68
|
+
* so every reported position still points at the original.
|
|
69
|
+
*
|
|
70
|
+
* A dialect that knows its language supplies one; `eess-ts` passes a
|
|
71
|
+
* ts-morph-backed masker. See ADR-012.
|
|
72
|
+
*/
|
|
73
|
+
export type MaskNonComment = (sourceText: string, filePath: string) => string;
|
|
74
|
+
export interface ParseExclusionOptions {
|
|
75
|
+
/**
|
|
76
|
+
* A dialect's own masker, applied BEFORE the kernel's default.
|
|
77
|
+
*
|
|
78
|
+
* Composition, not replacement (ADR-012 clause 3). An injected masker can only
|
|
79
|
+
* blank MORE than the default, never less, so the worst a bad one can do is
|
|
80
|
+
* hide a directive (loud) rather than expose one written inside a string
|
|
81
|
+
* literal (silent, and bug 0154).
|
|
82
|
+
*/
|
|
83
|
+
mask?: MaskNonComment;
|
|
84
|
+
}
|
|
85
|
+
export declare function parseExclusionComments(sourceText: string, filePath: string, options?: ParseExclusionOptions): ParseResult;
|
|
51
86
|
export declare function isExcludedByComment(violation: ArchViolation, comments: ExclusionComment[]): boolean;
|
|
52
87
|
//# sourceMappingURL=exclusion-comments.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exclusion-comments.d.ts","sourceRoot":"","sources":["../src/exclusion-comments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"exclusion-comments.d.ts","sourceRoot":"","sources":["../src/exclusion-comments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAGnD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAA;IACd,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAA;IACZ,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,oDAAoD;IACpD,OAAO,EAAE,OAAO,CAAA;IAChB,oCAAoC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,sBAAsB;IACtB,OAAO,EAAE,MAAM,CAAA;IACf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