lanekeep 0.9.0 → 0.10.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 +1 -0
- package/index.d.ts +26 -8
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -89,6 +89,7 @@ actual rule.
|
|
|
89
89
|
lanekeep check # the whole project
|
|
90
90
|
lanekeep check --staged # only what is about to be committed
|
|
91
91
|
lanekeep check --since main # only what changed against a ref
|
|
92
|
+
lanekeep check --file src/a.ts # exactly these files, repeatable, no git involved
|
|
92
93
|
lanekeep check --watch # re-check on every change, until Ctrl-C
|
|
93
94
|
lanekeep check --fix # apply the safe fixes, report what is left
|
|
94
95
|
lanekeep check --profile # per rule: where the time went, and what it looked at
|
package/index.d.ts
CHANGED
|
@@ -8,11 +8,10 @@
|
|
|
8
8
|
* Node: `defineRule` and `defineConfig` are identity functions whose only job is to give the
|
|
9
9
|
* compiler something to check against, and `RuleContext` is provided by lanekeep at run time.
|
|
10
10
|
* The world is the single source of truth for every member the renderer emits straight from it.
|
|
11
|
-
*
|
|
11
|
+
* Two members deviate from the world on purpose, and both are QuickJS-shaped: `today` is
|
|
12
12
|
* omitted from `RuleContext` because QuickJS exposes it as a conditional property rather than a
|
|
13
|
-
* callable, a shape this renderer cannot state honestly from the world; `
|
|
14
|
-
* `RuleContext` because
|
|
15
|
-
* `reduce-context`; and `types` is added to `RuleContext` because `ctx.types` — the bounded
|
|
13
|
+
* callable, a shape this renderer cannot state honestly from the world; and `types` is added
|
|
14
|
+
* to `RuleContext` because `ctx.types` — the bounded
|
|
16
15
|
* type oracle — is QuickJS-only and has no presence in `world.wit` at all: a component rule
|
|
17
16
|
* cannot declare `requires`, so there is nothing for the world to say about it. Nothing else is
|
|
18
17
|
* added or omitted by hand.
|
|
@@ -136,7 +135,13 @@ export interface Gates {
|
|
|
136
135
|
fileNotContains?: string[]
|
|
137
136
|
}
|
|
138
137
|
|
|
139
|
-
/**
|
|
138
|
+
/**
|
|
139
|
+
* A replacement a rule offers for a violation.
|
|
140
|
+
*
|
|
141
|
+
* A per-file offer alone: a fix names a node, and the reduce phase consumes facts and the
|
|
142
|
+
* file list and nothing else — there is no parse tree there for `node` to name, which is why
|
|
143
|
+
* a reduce report's options carry a message and never a fix.
|
|
144
|
+
*/
|
|
140
145
|
export interface Fix {
|
|
141
146
|
/** The node whose text is replaced. */
|
|
142
147
|
node: Node
|
|
@@ -160,6 +165,20 @@ export interface ReportOptions {
|
|
|
160
165
|
fix?: Fix
|
|
161
166
|
}
|
|
162
167
|
|
|
168
|
+
/** Options for a single reduce report. */
|
|
169
|
+
export interface ReduceReportOptions {
|
|
170
|
+
/** Overrides the card's `message` for this one violation. */
|
|
171
|
+
message?: string
|
|
172
|
+
/**
|
|
173
|
+
* Never present. A fix replaces a node's text, and the reduce phase has no parse tree —
|
|
174
|
+
* `node` has nothing to name, and both hosts throw on a supplied fix rather than drop it.
|
|
175
|
+
* Typed `never` rather than left absent so offering one fails to compile even for an
|
|
176
|
+
* object built before the call, which a fresh literal's excess-property check alone would
|
|
177
|
+
* admit.
|
|
178
|
+
*/
|
|
179
|
+
fix?: never
|
|
180
|
+
}
|
|
181
|
+
|
|
163
182
|
/**
|
|
164
183
|
* A fact a rule emits for the reduce phase.
|
|
165
184
|
*
|
|
@@ -381,8 +400,6 @@ export interface RuleContext {
|
|
|
381
400
|
emitFact(fact: Fact): void
|
|
382
401
|
loc(n: Node): NodeLocation | undefined
|
|
383
402
|
report(at: Node, message?: string | ReportOptions): void
|
|
384
|
-
/** Facts emitted so far, optionally filtered by `kind`. */
|
|
385
|
-
facts(kind?: string): EmittedFact[]
|
|
386
403
|
/**
|
|
387
404
|
* The type oracle, present only for a rule that declared `requires: ['types']`.
|
|
388
405
|
* Bounded by a fixed depth rather than by file: it follows an import into the
|
|
@@ -412,7 +429,8 @@ export interface ReduceLocation {
|
|
|
412
429
|
export interface ReduceContext {
|
|
413
430
|
readonly files: string[]
|
|
414
431
|
facts(kind?: string): EmittedFact[]
|
|
415
|
-
|
|
432
|
+
/** Takes a message; a supplied `fix` throws — there is no node to attach one to. */
|
|
433
|
+
report(at: ReduceLocation, message?: string | ReduceReportOptions): void
|
|
416
434
|
}
|
|
417
435
|
|
|
418
436
|
/** Queries whose named captures drive the taint analysis. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lanekeep",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Deterministic, AST-based architectural conformance checking",
|
|
5
5
|
"license": "MIT OR Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"node": ">=18"
|
|
24
24
|
},
|
|
25
25
|
"optionalDependencies": {
|
|
26
|
-
"@lanekeep/darwin-arm64": "0.
|
|
27
|
-
"@lanekeep/linux-arm64": "0.
|
|
28
|
-
"@lanekeep/linux-x64": "0.
|
|
29
|
-
"@lanekeep/win32-x64": "0.
|
|
26
|
+
"@lanekeep/darwin-arm64": "0.10.0",
|
|
27
|
+
"@lanekeep/linux-arm64": "0.10.0",
|
|
28
|
+
"@lanekeep/linux-x64": "0.10.0",
|
|
29
|
+
"@lanekeep/win32-x64": "0.10.0"
|
|
30
30
|
},
|
|
31
31
|
"main": "index.js",
|
|
32
32
|
"types": "index.d.ts",
|