@rdjperron/lint 0.3.0 → 0.6.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 +329 -64
- package/dist/config-CD2iCM6L.mjs +346 -0
- package/dist/config-CD2iCM6L.mjs.map +1 -0
- package/dist/config.d.mts +109 -11
- package/dist/config.mjs +2 -218
- package/dist/index.mjs +44 -10
- package/dist/index.mjs.map +1 -1
- package/dist/repo.d.mts +71 -0
- package/dist/repo.mjs +357 -0
- package/dist/repo.mjs.map +1 -0
- package/dist/verify.d.mts +1 -92
- package/dist/verify.mjs +124 -256
- package/dist/verify.mjs.map +1 -1
- package/fixtures/README.md +17 -24
- package/package.json +30 -17
- package/dist/config.mjs.map +0 -1
package/dist/repo.d.mts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
//#region src/repo.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The promises a repository's prose can only state, held as faults instead.
|
|
4
|
+
*
|
|
5
|
+
* - a relative Markdown link points at something that is there;
|
|
6
|
+
* - the decision register is one well-formed line per row, each number given once;
|
|
7
|
+
* - a decision number cited anywhere is a live row in the register, never a retired one;
|
|
8
|
+
* - a research entry is named by its date, and a dated folder opens with a README;
|
|
9
|
+
* - every path the config names is there and holds something to check.
|
|
10
|
+
*
|
|
11
|
+
* Every path in a fault is relative to the root, so it reads as the path you would type to open
|
|
12
|
+
* the offender. Nothing here imports a test runner: the consumer's test asserts on what
|
|
13
|
+
* `checkRepo` returns. It never throws on a tree or a config it cannot read: that is a fault too.
|
|
14
|
+
*/
|
|
15
|
+
export interface RepoConfig {
|
|
16
|
+
/** The repository root, absolute. */
|
|
17
|
+
root: string;
|
|
18
|
+
/**
|
|
19
|
+
* The directories scanned for decision numbers. Every path in this config is relative to the
|
|
20
|
+
* root, and `lib`, `./lib` and `lib/` name the same one.
|
|
21
|
+
*/
|
|
22
|
+
codeRoots: readonly string[];
|
|
23
|
+
/**
|
|
24
|
+
* The extensions scanned for decision numbers, in the code roots and at the root itself.
|
|
25
|
+
* Replaces `DEFAULT_EXTENSIONS`.
|
|
26
|
+
*/
|
|
27
|
+
extensions?: readonly string[];
|
|
28
|
+
/** Directory and file names no walk enters, wherever they sit. Added to `DEFAULT_SKIP`. */
|
|
29
|
+
skip?: readonly string[];
|
|
30
|
+
/** Paths no walk enters, each with the reason it is left out. */
|
|
31
|
+
leftOut?: {
|
|
32
|
+
readonly [path: string]: string;
|
|
33
|
+
};
|
|
34
|
+
/** The living documents at the root. Replaces `DEFAULT_DOCUMENTS`. */
|
|
35
|
+
documents?: readonly string[];
|
|
36
|
+
/** The directory whose every Markdown file is a living document. `docs` by default. */
|
|
37
|
+
docs?: string;
|
|
38
|
+
/** More documents held as the living ones are, for their links and their citations. */
|
|
39
|
+
linked?: readonly string[];
|
|
40
|
+
/** The decision register. `decisions.md` in the `docs` directory by default. */
|
|
41
|
+
register?: string;
|
|
42
|
+
/** The research directory. `_research` by default, and a repo may have none yet. */
|
|
43
|
+
research?: string;
|
|
44
|
+
}
|
|
45
|
+
export declare const CHECKS: readonly ["scans", "links", "register", "citations", "research"];
|
|
46
|
+
export type Check = (typeof CHECKS)[number];
|
|
47
|
+
/** The faults of each check, empty where the check holds. */
|
|
48
|
+
export type RepoFaults = { readonly [check in Check]: readonly string[]; };
|
|
49
|
+
/** What each check promises, for the title of the consumer's test. */
|
|
50
|
+
export declare const TITLES: {
|
|
51
|
+
scans: string;
|
|
52
|
+
links: string;
|
|
53
|
+
register: string;
|
|
54
|
+
citations: string;
|
|
55
|
+
research: string;
|
|
56
|
+
};
|
|
57
|
+
/** What to do about a failing check, for the message of the consumer's assertion. */
|
|
58
|
+
export declare const HINTS: {
|
|
59
|
+
scans: string;
|
|
60
|
+
links: string;
|
|
61
|
+
register: string;
|
|
62
|
+
citations: string;
|
|
63
|
+
research: string;
|
|
64
|
+
};
|
|
65
|
+
export declare const DEFAULT_DOCUMENTS: readonly string[];
|
|
66
|
+
export declare const DEFAULT_EXTENSIONS: readonly string[];
|
|
67
|
+
/** Vendored, generated and built trees. */
|
|
68
|
+
export declare const DEFAULT_SKIP: readonly string[];
|
|
69
|
+
export declare function checkRepo(config: RepoConfig): RepoFaults;
|
|
70
|
+
//#endregion
|
|
71
|
+
//# sourceMappingURL=repo.d.mts.map
|
package/dist/repo.mjs
ADDED
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
import { lstatSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
2
|
+
import { dirname, join, posix, relative, resolve } from "node:path";
|
|
3
|
+
//#region src/repo.ts
|
|
4
|
+
/**
|
|
5
|
+
* The promises a repository's prose can only state, held as faults instead.
|
|
6
|
+
*
|
|
7
|
+
* - a relative Markdown link points at something that is there;
|
|
8
|
+
* - the decision register is one well-formed line per row, each number given once;
|
|
9
|
+
* - a decision number cited anywhere is a live row in the register, never a retired one;
|
|
10
|
+
* - a research entry is named by its date, and a dated folder opens with a README;
|
|
11
|
+
* - every path the config names is there and holds something to check.
|
|
12
|
+
*
|
|
13
|
+
* Every path in a fault is relative to the root, so it reads as the path you would type to open
|
|
14
|
+
* the offender. Nothing here imports a test runner: the consumer's test asserts on what
|
|
15
|
+
* `checkRepo` returns. It never throws on a tree or a config it cannot read: that is a fault too.
|
|
16
|
+
*/
|
|
17
|
+
const CHECKS = [
|
|
18
|
+
"scans",
|
|
19
|
+
"links",
|
|
20
|
+
"register",
|
|
21
|
+
"citations",
|
|
22
|
+
"research"
|
|
23
|
+
];
|
|
24
|
+
/** What each check promises, for the title of the consumer's test. */
|
|
25
|
+
const TITLES = {
|
|
26
|
+
scans: "every path the config names is there and holds something to check",
|
|
27
|
+
links: "every relative Markdown link resolves",
|
|
28
|
+
register: "the register is one well-formed line per row, each number given once",
|
|
29
|
+
citations: "every decision number cited anywhere is a live row in the register",
|
|
30
|
+
research: "every research entry is named by its date, and every dated folder has a README"
|
|
31
|
+
};
|
|
32
|
+
/** What to do about a failing check, for the message of the consumer's assertion. */
|
|
33
|
+
const HINTS = {
|
|
34
|
+
scans: "A check that reads nothing passes on nothing. Correct the path in the config, or remove it with the thing it named.",
|
|
35
|
+
links: "Fix the path, or delete the link with the thing it pointed at.",
|
|
36
|
+
register: "A row is one line, its number given once and never after it was retired, and a number that leaves the rows joins the retired list. Rewrite a rule in place under its own number.",
|
|
37
|
+
citations: "A citation of a retired number, or of one never given, sends the reader nowhere. Cite the row that carries the rule now. `git log -S \"D<n>\"` on the register shows what a retired row said.",
|
|
38
|
+
research: "The research sorts by name, so the name carries the date. Date an entry by the day it was opened, and give a folder a README that says what is in it."
|
|
39
|
+
};
|
|
40
|
+
const DEFAULT_DOCUMENTS = [
|
|
41
|
+
"README.md",
|
|
42
|
+
"AGENTS.md",
|
|
43
|
+
"BACKLOG.md"
|
|
44
|
+
];
|
|
45
|
+
const DEFAULT_EXTENSIONS = [
|
|
46
|
+
"ts",
|
|
47
|
+
"tsx",
|
|
48
|
+
"mts",
|
|
49
|
+
"cts",
|
|
50
|
+
"js",
|
|
51
|
+
"jsx",
|
|
52
|
+
"mjs",
|
|
53
|
+
"cjs",
|
|
54
|
+
"md",
|
|
55
|
+
"json",
|
|
56
|
+
"jsonc",
|
|
57
|
+
"yml",
|
|
58
|
+
"yaml",
|
|
59
|
+
"html"
|
|
60
|
+
];
|
|
61
|
+
/** Vendored, generated and built trees. */
|
|
62
|
+
const DEFAULT_SKIP = [
|
|
63
|
+
"node_modules",
|
|
64
|
+
"_generated",
|
|
65
|
+
"dist"
|
|
66
|
+
];
|
|
67
|
+
function kindOf(tree, path) {
|
|
68
|
+
try {
|
|
69
|
+
return statSync(join(tree.root, path)).isDirectory() ? "directory" : "file";
|
|
70
|
+
} catch {
|
|
71
|
+
return "absent";
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function isSymbolicLink(tree, path) {
|
|
75
|
+
try {
|
|
76
|
+
return lstatSync(join(tree.root, path)).isSymbolicLink();
|
|
77
|
+
} catch {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function read(tree, path) {
|
|
82
|
+
return readFileSync(join(tree.root, path), "utf8").replaceAll("\r\n", "\n");
|
|
83
|
+
}
|
|
84
|
+
function names(tree, path) {
|
|
85
|
+
try {
|
|
86
|
+
return readdirSync(join(tree.root, path)).toSorted();
|
|
87
|
+
} catch {
|
|
88
|
+
return [];
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function child(base, name) {
|
|
92
|
+
return base === "" ? name : `${base}/${name}`;
|
|
93
|
+
}
|
|
94
|
+
function walk(tree, base) {
|
|
95
|
+
return names(tree, base).flatMap((name) => {
|
|
96
|
+
const path = child(base, name);
|
|
97
|
+
if (tree.skip.has(name) || tree.leftOut.has(path)) return [];
|
|
98
|
+
const kind = kindOf(tree, path);
|
|
99
|
+
if (kind === "file") return [path];
|
|
100
|
+
if (kind === "absent") tree.broken.add(path);
|
|
101
|
+
return kind === "directory" && !isSymbolicLink(tree, path) ? walk(tree, path) : [];
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
/** `lib`, `./lib` and `lib/` are one path, and the root itself is the empty one. */
|
|
105
|
+
function normal(path) {
|
|
106
|
+
const clean = posix.normalize(path).replace(/\/+$/, "");
|
|
107
|
+
return clean === "." ? "" : clean;
|
|
108
|
+
}
|
|
109
|
+
function hasExtension(name, extensions) {
|
|
110
|
+
return extensions.some((extension) => name.endsWith(`.${extension}`));
|
|
111
|
+
}
|
|
112
|
+
function lineOf(source, index) {
|
|
113
|
+
return source.slice(0, index).split("\n").length;
|
|
114
|
+
}
|
|
115
|
+
/** A single note, `YYYYMMDD.HHMM.topic.md`. */
|
|
116
|
+
const DATED_NOTE = /^\d{8}\.\d{4}\.[a-z0-9-]+\.md$/;
|
|
117
|
+
/** Research of several files, `YYYYMMDD.topic/`. */
|
|
118
|
+
const DATED_FOLDER = /^\d{8}\.[a-z0-9-]+$/;
|
|
119
|
+
function researchFaults(tree, entries) {
|
|
120
|
+
return entries.flatMap((entry) => {
|
|
121
|
+
if (!(entry.folder ? DATED_FOLDER : DATED_NOTE).test(entry.name)) return [`${entry.path} is not named YYYYMMDD.HHMM.topic.md or YYYYMMDD.topic/`];
|
|
122
|
+
return entry.folder && kindOf(tree, `${entry.path}/README.md`) !== "file" ? [`${entry.path}/ has no README.md`] : [];
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
/** `](target)`, with an optional title. Bare `path.md` inside backticks is not a link. */
|
|
126
|
+
const LINK = /\]\(([^)\s]+)(?:\s+"[^"]*")?\)/g;
|
|
127
|
+
/** A scheme, a protocol-relative host or a bare anchor: the target is outside the tree. */
|
|
128
|
+
const OUTSIDE = /^(?:[a-z][a-z0-9+.-]*:|\/\/|#)/i;
|
|
129
|
+
function decoded(target) {
|
|
130
|
+
try {
|
|
131
|
+
return decodeURI(target.split("#")[0] ?? "");
|
|
132
|
+
} catch {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function linksIn(tree, file) {
|
|
137
|
+
const source = read(tree, file);
|
|
138
|
+
return [...source.matchAll(LINK)].flatMap((match) => {
|
|
139
|
+
const target = match[1] ?? "";
|
|
140
|
+
const path = decoded(target);
|
|
141
|
+
if (OUTSIDE.test(target) || path === "") return [];
|
|
142
|
+
const points = path === void 0 ? void 0 : relative(tree.root, resolve(tree.root, dirname(file), path));
|
|
143
|
+
return [{
|
|
144
|
+
from: file,
|
|
145
|
+
target,
|
|
146
|
+
line: lineOf(source, match.index),
|
|
147
|
+
points
|
|
148
|
+
}];
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
function linkFaults(tree, links) {
|
|
152
|
+
return links.flatMap((link) => {
|
|
153
|
+
const at = `${link.from}:${link.line} points at ${link.target}`;
|
|
154
|
+
if (link.points === void 0) return [`${at}, whose percent-escapes do not decode`];
|
|
155
|
+
return kindOf(tree, link.points) === "absent" ? [`${at}, which is not there`] : [];
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
/** A line that opens as a row does: a list item whose first word is a bold decision number. */
|
|
159
|
+
const ROW_START = /^- \*\*D(\d+)\*\*/gm;
|
|
160
|
+
/** A whole row: the number, one sentence or more, then the date and an optional source. */
|
|
161
|
+
const ROW = /^- \*\*D\d+\*\* \S.*[.?!] \(\d{4}-\d{2}-\d{2}(?:, \S.*)?\)$/;
|
|
162
|
+
/** A line that names a number in bold as a row does, whatever it opens with. */
|
|
163
|
+
const ROW_LIKE = /\*\*D\d+\*\*/;
|
|
164
|
+
const RETIRED_SECTION = /^## Retired[ \t]*$([\s\S]*?)(?=^## |(?![\s\S]))/m;
|
|
165
|
+
/** A mistyped number in the retired list would otherwise print a gap per number below it. */
|
|
166
|
+
const GAPS_SHOWN = 20;
|
|
167
|
+
const CITATION = /\bD(\d+)\b/g;
|
|
168
|
+
function numbersIn(text) {
|
|
169
|
+
return [...text.matchAll(CITATION)].map((match) => Number(match[1]));
|
|
170
|
+
}
|
|
171
|
+
function readRegister(tree, path) {
|
|
172
|
+
const text = kindOf(tree, path) === "file" ? read(tree, path) : "";
|
|
173
|
+
const rows = [...text.matchAll(ROW_START)].map((match) => ({
|
|
174
|
+
number: Number(match[1]),
|
|
175
|
+
line: lineOf(text, match.index),
|
|
176
|
+
text: text.slice(match.index).split("\n", 1)[0] ?? ""
|
|
177
|
+
}));
|
|
178
|
+
const section = RETIRED_SECTION.exec(text);
|
|
179
|
+
return {
|
|
180
|
+
path,
|
|
181
|
+
text,
|
|
182
|
+
rows,
|
|
183
|
+
live: new Set(rows.map((row) => row.number)),
|
|
184
|
+
retired: new Set(numbersIn(section?.[1] ?? "")),
|
|
185
|
+
hasRetiredSection: section !== null
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
function rowFaults(register) {
|
|
189
|
+
const seen = /* @__PURE__ */ new Set();
|
|
190
|
+
return register.rows.flatMap((row) => {
|
|
191
|
+
const at = `${register.path}:${row.line} D${row.number}`;
|
|
192
|
+
const found = [
|
|
193
|
+
...ROW.test(row.text) ? [] : [`${at} is not "- **Dn** Sentence. (date, source)"`],
|
|
194
|
+
...seen.has(row.number) ? [`${at} is a second row`] : [],
|
|
195
|
+
...register.retired.has(row.number) ? [`${at} is retired`] : []
|
|
196
|
+
];
|
|
197
|
+
seen.add(row.number);
|
|
198
|
+
return found;
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
function gapFaults(register) {
|
|
202
|
+
const highest = Math.max(0, ...register.live, ...register.retired);
|
|
203
|
+
const gaps = [];
|
|
204
|
+
let more = 0;
|
|
205
|
+
for (let number = 1; number <= highest; number++) {
|
|
206
|
+
if (register.live.has(number) || register.retired.has(number)) continue;
|
|
207
|
+
if (gaps.length < GAPS_SHOWN) gaps.push(number);
|
|
208
|
+
else more++;
|
|
209
|
+
}
|
|
210
|
+
return [...gaps.map((number) => `${register.path} D${number} is neither a row nor retired`), ...more === 0 ? [] : [`${register.path} ${more} more numbers up to D${highest} are neither a row nor retired`]];
|
|
211
|
+
}
|
|
212
|
+
function registerFaults(register) {
|
|
213
|
+
const rowLike = register.text.split("\n").flatMap((text, index) => ROW_LIKE.test(text) && !text.startsWith("- **D") ? [`${register.path}:${index + 1} names a row but is not one: "${text.slice(0, 40)}"`] : []);
|
|
214
|
+
return [
|
|
215
|
+
...rowFaults(register),
|
|
216
|
+
...rowLike,
|
|
217
|
+
...register.hasRetiredSection ? [] : [`${register.path} has no "## Retired" section`],
|
|
218
|
+
...gapFaults(register)
|
|
219
|
+
];
|
|
220
|
+
}
|
|
221
|
+
function citationsIn(tree, file) {
|
|
222
|
+
const source = read(tree, file);
|
|
223
|
+
return [...source.matchAll(CITATION)].map((match) => ({
|
|
224
|
+
where: `${file}:${lineOf(source, match.index)}`,
|
|
225
|
+
number: Number(match[1])
|
|
226
|
+
}));
|
|
227
|
+
}
|
|
228
|
+
/** A row may cite another row. The retired list and the prose around the rows are not held. */
|
|
229
|
+
function citationsInRows(register) {
|
|
230
|
+
return register.rows.flatMap((row) => numbersIn(row.text.slice(row.text.indexOf("**", 4) + 2)).map((number) => ({
|
|
231
|
+
where: `${register.path}:${row.line}`,
|
|
232
|
+
number
|
|
233
|
+
})));
|
|
234
|
+
}
|
|
235
|
+
function citationFaults(register, citations) {
|
|
236
|
+
return citations.flatMap(({ where, number }) => {
|
|
237
|
+
if (register.live.has(number)) return [];
|
|
238
|
+
return register.retired.has(number) ? [`${where} cites D${number}, which is retired`] : [`${where} cites D${number}, which the register has no row for`];
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
function isUnder(path, base) {
|
|
242
|
+
return base === "" || path === base || path.startsWith(`${base}/`);
|
|
243
|
+
}
|
|
244
|
+
/** `package-lock.json`, `pnpm-lock.yaml`: generated, and full of hashes that read like numbers. */
|
|
245
|
+
const LOCKFILE = /[-_.]lock\.(?:json|jsonc|ya?ml)$/;
|
|
246
|
+
function allNamed(by, paths, want) {
|
|
247
|
+
return paths.map((path) => ({
|
|
248
|
+
path: normal(path),
|
|
249
|
+
by,
|
|
250
|
+
want
|
|
251
|
+
}));
|
|
252
|
+
}
|
|
253
|
+
function namedOr(option, path, fallback, want) {
|
|
254
|
+
return path === void 0 ? {
|
|
255
|
+
path: fallback,
|
|
256
|
+
by: `the default of \`${option}\``,
|
|
257
|
+
want
|
|
258
|
+
} : {
|
|
259
|
+
path: normal(path),
|
|
260
|
+
by: `named by \`${option}\``,
|
|
261
|
+
want
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
function namedFault(tree, named) {
|
|
265
|
+
const kind = kindOf(tree, named.path);
|
|
266
|
+
if (kind === named.want) return [];
|
|
267
|
+
return [`${named.path === "" ? "." : named.path}, ${named.by}, is ${kind === "absent" ? "not there" : `not a ${named.want}`}`];
|
|
268
|
+
}
|
|
269
|
+
function usable(tree, named) {
|
|
270
|
+
return named.flatMap((one) => kindOf(tree, one.path) === one.want ? [one.path] : []);
|
|
271
|
+
}
|
|
272
|
+
const NO_FAULTS = {
|
|
273
|
+
scans: [],
|
|
274
|
+
links: [],
|
|
275
|
+
register: [],
|
|
276
|
+
citations: [],
|
|
277
|
+
research: []
|
|
278
|
+
};
|
|
279
|
+
function checkRepo(config) {
|
|
280
|
+
const leftOut = Object.keys(config.leftOut ?? {}).map(normal);
|
|
281
|
+
const tree = {
|
|
282
|
+
root: resolve(config.root),
|
|
283
|
+
skip: /* @__PURE__ */ new Set([...DEFAULT_SKIP, ...config.skip ?? []]),
|
|
284
|
+
leftOut: new Set(leftOut),
|
|
285
|
+
extensions: config.extensions ?? DEFAULT_EXTENSIONS,
|
|
286
|
+
broken: /* @__PURE__ */ new Set()
|
|
287
|
+
};
|
|
288
|
+
if (kindOf(tree, "") !== "directory") return {
|
|
289
|
+
...NO_FAULTS,
|
|
290
|
+
scans: [`${tree.root}, named by \`root\`, is not a directory`]
|
|
291
|
+
};
|
|
292
|
+
const docs = namedOr("docs", config.docs, "docs", "directory");
|
|
293
|
+
const registerAt = namedOr("register", config.register, child(docs.path, "decisions.md"), "file");
|
|
294
|
+
const research = namedOr("research", config.research, "_research", "directory");
|
|
295
|
+
const codeRoots = allNamed("named by `codeRoots`", config.codeRoots, "directory");
|
|
296
|
+
const documents = config.documents === void 0 ? allNamed("a default of `documents`", DEFAULT_DOCUMENTS, "file") : allNamed("named by `documents`", config.documents, "file");
|
|
297
|
+
const linked = allNamed("named by `linked`", config.linked ?? [], "file");
|
|
298
|
+
const researchKind = kindOf(tree, research.path);
|
|
299
|
+
const entries = (researchKind === "directory" ? names(tree, research.path) : []).flatMap((name) => {
|
|
300
|
+
const path = child(research.path, name);
|
|
301
|
+
const kind = kindOf(tree, path);
|
|
302
|
+
if (kind === "absent") tree.broken.add(path);
|
|
303
|
+
return kind === "absent" ? [] : [{
|
|
304
|
+
path,
|
|
305
|
+
name,
|
|
306
|
+
folder: kind === "directory"
|
|
307
|
+
}];
|
|
308
|
+
});
|
|
309
|
+
const frozen = (file) => isUnder(file, research.path);
|
|
310
|
+
const living = [
|
|
311
|
+
...usable(tree, documents),
|
|
312
|
+
...walk(tree, docs.path).filter((file) => file.endsWith(".md") && !frozen(file)),
|
|
313
|
+
...usable(tree, linked)
|
|
314
|
+
];
|
|
315
|
+
const linking = /* @__PURE__ */ new Set([...living, ...entries.flatMap((entry) => {
|
|
316
|
+
const readme = `${entry.path}/README.md`;
|
|
317
|
+
return entry.folder && kindOf(tree, readme) === "file" ? [readme] : [];
|
|
318
|
+
})]);
|
|
319
|
+
const scanned = usable(tree, codeRoots).map((base) => ({
|
|
320
|
+
base,
|
|
321
|
+
files: walk(tree, base).filter((file) => hasExtension(file, tree.extensions))
|
|
322
|
+
}));
|
|
323
|
+
const atRoot = names(tree, "").filter((name) => hasExtension(name, tree.extensions) && !tree.skip.has(name) && !tree.leftOut.has(name) && kindOf(tree, name) === "file");
|
|
324
|
+
const citing = [.../* @__PURE__ */ new Set([
|
|
325
|
+
...living,
|
|
326
|
+
...scanned.flatMap((scan) => scan.files),
|
|
327
|
+
...atRoot
|
|
328
|
+
])].filter((file) => file !== registerAt.path && !frozen(file) && !LOCKFILE.test(file));
|
|
329
|
+
const held = kindOf(tree, registerAt.path) === "file";
|
|
330
|
+
const register = readRegister(tree, registerAt.path);
|
|
331
|
+
const wrongKind = researchKind === "file" ? namedFault(tree, research) : [];
|
|
332
|
+
const leftOutFaults = leftOut.flatMap((path) => kindOf(tree, path) === "absent" ? [`${path}, named by \`leftOut\`, is not there`] : []);
|
|
333
|
+
return {
|
|
334
|
+
scans: [
|
|
335
|
+
...[
|
|
336
|
+
...codeRoots,
|
|
337
|
+
...documents,
|
|
338
|
+
docs,
|
|
339
|
+
registerAt,
|
|
340
|
+
...linked
|
|
341
|
+
].flatMap((one) => namedFault(tree, one)),
|
|
342
|
+
...wrongKind,
|
|
343
|
+
...leftOutFaults,
|
|
344
|
+
...scanned.flatMap((scan) => scan.files.length === 0 ? [`${scan.base === "" ? "." : scan.base} holds no file to scan for decision numbers`] : []),
|
|
345
|
+
...held && register.rows.length === 0 ? [`${registerAt.path} holds no row`] : [],
|
|
346
|
+
...[...tree.broken].toSorted().map((path) => `${path} is a symbolic link that leads nowhere`)
|
|
347
|
+
],
|
|
348
|
+
links: linkFaults(tree, [...linking].flatMap((file) => linksIn(tree, file))),
|
|
349
|
+
register: held ? registerFaults(register) : [],
|
|
350
|
+
citations: held ? citationFaults(register, [...citing.flatMap((file) => citationsIn(tree, file)), ...citationsInRows(register)]) : [],
|
|
351
|
+
research: researchFaults(tree, entries)
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
//#endregion
|
|
355
|
+
export { CHECKS, DEFAULT_DOCUMENTS, DEFAULT_EXTENSIONS, DEFAULT_SKIP, HINTS, TITLES, checkRepo };
|
|
356
|
+
|
|
357
|
+
//# sourceMappingURL=repo.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repo.mjs","names":[],"sources":["../src/repo.ts"],"sourcesContent":["/**\n * The promises a repository's prose can only state, held as faults instead.\n *\n * - a relative Markdown link points at something that is there;\n * - the decision register is one well-formed line per row, each number given once;\n * - a decision number cited anywhere is a live row in the register, never a retired one;\n * - a research entry is named by its date, and a dated folder opens with a README;\n * - every path the config names is there and holds something to check.\n *\n * Every path in a fault is relative to the root, so it reads as the path you would type to open\n * the offender. Nothing here imports a test runner: the consumer's test asserts on what\n * `checkRepo` returns. It never throws on a tree or a config it cannot read: that is a fault too.\n */\n\nimport { lstatSync, readdirSync, readFileSync, statSync } from \"node:fs\";\nimport { dirname, join, posix, relative, resolve } from \"node:path\";\n\nexport interface RepoConfig {\n /** The repository root, absolute. */\n root: string;\n /**\n * The directories scanned for decision numbers. Every path in this config is relative to the\n * root, and `lib`, `./lib` and `lib/` name the same one.\n */\n codeRoots: readonly string[];\n /**\n * The extensions scanned for decision numbers, in the code roots and at the root itself.\n * Replaces `DEFAULT_EXTENSIONS`.\n */\n extensions?: readonly string[];\n /** Directory and file names no walk enters, wherever they sit. Added to `DEFAULT_SKIP`. */\n skip?: readonly string[];\n /** Paths no walk enters, each with the reason it is left out. */\n leftOut?: { readonly [path: string]: string };\n /** The living documents at the root. Replaces `DEFAULT_DOCUMENTS`. */\n documents?: readonly string[];\n /** The directory whose every Markdown file is a living document. `docs` by default. */\n docs?: string;\n /** More documents held as the living ones are, for their links and their citations. */\n linked?: readonly string[];\n /** The decision register. `decisions.md` in the `docs` directory by default. */\n register?: string;\n /** The research directory. `_research` by default, and a repo may have none yet. */\n research?: string;\n}\n\nexport const CHECKS = [\"scans\", \"links\", \"register\", \"citations\", \"research\"] as const;\n\nexport type Check = (typeof CHECKS)[number];\n\n/** The faults of each check, empty where the check holds. */\nexport type RepoFaults = { readonly [check in Check]: readonly string[] };\n\n/** What each check promises, for the title of the consumer's test. */\nexport const TITLES = {\n scans: \"every path the config names is there and holds something to check\",\n links: \"every relative Markdown link resolves\",\n register: \"the register is one well-formed line per row, each number given once\",\n citations: \"every decision number cited anywhere is a live row in the register\",\n research: \"every research entry is named by its date, and every dated folder has a README\",\n} satisfies { readonly [check in Check]: string };\n\n/** What to do about a failing check, for the message of the consumer's assertion. */\nexport const HINTS = {\n scans:\n \"A check that reads nothing passes on nothing. Correct the path in the config, or remove it \" +\n \"with the thing it named.\",\n links: \"Fix the path, or delete the link with the thing it pointed at.\",\n register:\n \"A row is one line, its number given once and never after it was retired, and a number that \" +\n \"leaves the rows joins the retired list. Rewrite a rule in place under its own number.\",\n citations:\n \"A citation of a retired number, or of one never given, sends the reader nowhere. Cite the \" +\n 'row that carries the rule now. `git log -S \"D<n>\"` on the register shows what a retired ' +\n \"row said.\",\n research:\n \"The research sorts by name, so the name carries the date. Date an entry by the day it was \" +\n \"opened, and give a folder a README that says what is in it.\",\n} satisfies { readonly [check in Check]: string };\n\nexport const DEFAULT_DOCUMENTS: readonly string[] = [\"README.md\", \"AGENTS.md\", \"BACKLOG.md\"];\n\nexport const DEFAULT_EXTENSIONS: readonly string[] = [\n \"ts\",\n \"tsx\",\n \"mts\",\n \"cts\",\n \"js\",\n \"jsx\",\n \"mjs\",\n \"cjs\",\n \"md\",\n \"json\",\n \"jsonc\",\n \"yml\",\n \"yaml\",\n \"html\",\n];\n\n/** Vendored, generated and built trees. */\nexport const DEFAULT_SKIP: readonly string[] = [\"node_modules\", \"_generated\", \"dist\"];\n\ninterface Tree {\n root: string;\n skip: ReadonlySet<string>;\n leftOut: ReadonlySet<string>;\n extensions: readonly string[];\n /** Symbolic links a walk met that lead nowhere. */\n broken: Set<string>;\n}\n\ntype Kind = \"file\" | \"directory\" | \"absent\";\n\nfunction kindOf(tree: Tree, path: string): Kind {\n try {\n return statSync(join(tree.root, path)).isDirectory() ? \"directory\" : \"file\";\n } catch {\n return \"absent\";\n }\n}\n\nfunction isSymbolicLink(tree: Tree, path: string): boolean {\n try {\n return lstatSync(join(tree.root, path)).isSymbolicLink();\n } catch {\n return false;\n }\n}\n\n// A Windows checkout may hand back CRLF, and every pattern here ends its line on `\\n`.\nfunction read(tree: Tree, path: string): string {\n return readFileSync(join(tree.root, path), \"utf8\").replaceAll(\"\\r\\n\", \"\\n\");\n}\n\nfunction names(tree: Tree, path: string): string[] {\n try {\n return readdirSync(join(tree.root, path)).toSorted();\n } catch {\n return [];\n }\n}\n\nfunction child(base: string, name: string): string {\n return base === \"\" ? name : `${base}/${name}`;\n}\n\n// A linked directory is not entered: it may lead back to one of its own parents.\nfunction walk(tree: Tree, base: string): string[] {\n return names(tree, base).flatMap((name) => {\n const path = child(base, name);\n if (tree.skip.has(name) || tree.leftOut.has(path)) return [];\n const kind = kindOf(tree, path);\n if (kind === \"file\") return [path];\n if (kind === \"absent\") tree.broken.add(path);\n return kind === \"directory\" && !isSymbolicLink(tree, path) ? walk(tree, path) : [];\n });\n}\n\n/** `lib`, `./lib` and `lib/` are one path, and the root itself is the empty one. */\nfunction normal(path: string): string {\n const clean = posix.normalize(path).replace(/\\/+$/, \"\");\n return clean === \".\" ? \"\" : clean;\n}\n\nfunction hasExtension(name: string, extensions: readonly string[]): boolean {\n return extensions.some((extension) => name.endsWith(`.${extension}`));\n}\n\nfunction lineOf(source: string, index: number): number {\n return source.slice(0, index).split(\"\\n\").length;\n}\n\n/** A single note, `YYYYMMDD.HHMM.topic.md`. */\nconst DATED_NOTE = /^\\d{8}\\.\\d{4}\\.[a-z0-9-]+\\.md$/;\n\n/** Research of several files, `YYYYMMDD.topic/`. */\nconst DATED_FOLDER = /^\\d{8}\\.[a-z0-9-]+$/;\n\ninterface Entry {\n path: string;\n name: string;\n folder: boolean;\n}\n\nfunction researchFaults(tree: Tree, entries: readonly Entry[]): string[] {\n return entries.flatMap((entry) => {\n if (!(entry.folder ? DATED_FOLDER : DATED_NOTE).test(entry.name)) {\n return [`${entry.path} is not named YYYYMMDD.HHMM.topic.md or YYYYMMDD.topic/`];\n }\n return entry.folder && kindOf(tree, `${entry.path}/README.md`) !== \"file\"\n ? [`${entry.path}/ has no README.md`]\n : [];\n });\n}\n\n/** `](target)`, with an optional title. Bare `path.md` inside backticks is not a link. */\nconst LINK = /\\]\\(([^)\\s]+)(?:\\s+\"[^\"]*\")?\\)/g;\n\n/** A scheme, a protocol-relative host or a bare anchor: the target is outside the tree. */\nconst OUTSIDE = /^(?:[a-z][a-z0-9+.-]*:|\\/\\/|#)/i;\n\ninterface Link {\n from: string;\n target: string;\n line: number;\n /** Where the target leads, relative to the root. Absent when its escapes do not decode. */\n points: string | undefined;\n}\n\nfunction decoded(target: string): string | undefined {\n try {\n return decodeURI(target.split(\"#\")[0] ?? \"\");\n } catch {\n return undefined;\n }\n}\n\nfunction linksIn(tree: Tree, file: string): Link[] {\n const source = read(tree, file);\n return [...source.matchAll(LINK)].flatMap((match) => {\n const target = match[1] ?? \"\";\n const path = decoded(target);\n if (OUTSIDE.test(target) || path === \"\") return [];\n const points =\n path === undefined ? undefined : relative(tree.root, resolve(tree.root, dirname(file), path));\n return [{ from: file, target, line: lineOf(source, match.index), points }];\n });\n}\n\nfunction linkFaults(tree: Tree, links: readonly Link[]): string[] {\n return links.flatMap((link) => {\n const at = `${link.from}:${link.line} points at ${link.target}`;\n if (link.points === undefined) return [`${at}, whose percent-escapes do not decode`];\n return kindOf(tree, link.points) === \"absent\" ? [`${at}, which is not there`] : [];\n });\n}\n\n/** A line that opens as a row does: a list item whose first word is a bold decision number. */\nconst ROW_START = /^- \\*\\*D(\\d+)\\*\\*/gm;\n\n/** A whole row: the number, one sentence or more, then the date and an optional source. */\nconst ROW = /^- \\*\\*D\\d+\\*\\* \\S.*[.?!] \\(\\d{4}-\\d{2}-\\d{2}(?:, \\S.*)?\\)$/;\n\n/** A line that names a number in bold as a row does, whatever it opens with. */\nconst ROW_LIKE = /\\*\\*D\\d+\\*\\*/;\n\nconst RETIRED_SECTION = /^## Retired[ \\t]*$([\\s\\S]*?)(?=^## |(?![\\s\\S]))/m;\n\n/** A mistyped number in the retired list would otherwise print a gap per number below it. */\nconst GAPS_SHOWN = 20;\n\nconst CITATION = /\\bD(\\d+)\\b/g;\n\ninterface Row {\n number: number;\n line: number;\n text: string;\n}\n\ninterface Register {\n path: string;\n text: string;\n rows: readonly Row[];\n live: ReadonlySet<number>;\n /** Every number the `## Retired` section names, however its lines wrap. */\n retired: ReadonlySet<number>;\n hasRetiredSection: boolean;\n}\n\nfunction numbersIn(text: string): number[] {\n return [...text.matchAll(CITATION)].map((match) => Number(match[1]));\n}\n\nfunction readRegister(tree: Tree, path: string): Register {\n const text = kindOf(tree, path) === \"file\" ? read(tree, path) : \"\";\n const rows = [...text.matchAll(ROW_START)].map((match) => ({\n number: Number(match[1]),\n line: lineOf(text, match.index),\n text: text.slice(match.index).split(\"\\n\", 1)[0] ?? \"\",\n }));\n const section = RETIRED_SECTION.exec(text);\n return {\n path,\n text,\n rows,\n live: new Set(rows.map((row) => row.number)),\n retired: new Set(numbersIn(section?.[1] ?? \"\")),\n hasRetiredSection: section !== null,\n };\n}\n\nfunction rowFaults(register: Register): string[] {\n const seen = new Set<number>();\n return register.rows.flatMap((row) => {\n const at = `${register.path}:${row.line} D${row.number}`;\n const found = [\n ...(ROW.test(row.text) ? [] : [`${at} is not \"- **Dn** Sentence. (date, source)\"`]),\n ...(seen.has(row.number) ? [`${at} is a second row`] : []),\n ...(register.retired.has(row.number) ? [`${at} is retired`] : []),\n ];\n seen.add(row.number);\n return found;\n });\n}\n\nfunction gapFaults(register: Register): string[] {\n const highest = Math.max(0, ...register.live, ...register.retired);\n const gaps: number[] = [];\n let more = 0;\n for (let number = 1; number <= highest; number++) {\n if (register.live.has(number) || register.retired.has(number)) continue;\n if (gaps.length < GAPS_SHOWN) gaps.push(number);\n else more++;\n }\n return [\n ...gaps.map((number) => `${register.path} D${number} is neither a row nor retired`),\n ...(more === 0\n ? []\n : [`${register.path} ${more} more numbers up to D${highest} are neither a row nor retired`]),\n ];\n}\n\nfunction registerFaults(register: Register): string[] {\n const rowLike = register.text\n .split(\"\\n\")\n .flatMap((text, index) =>\n ROW_LIKE.test(text) && !text.startsWith(\"- **D\")\n ? [`${register.path}:${index + 1} names a row but is not one: \"${text.slice(0, 40)}\"`]\n : [],\n );\n return [\n ...rowFaults(register),\n ...rowLike,\n ...(register.hasRetiredSection ? [] : [`${register.path} has no \"## Retired\" section`]),\n ...gapFaults(register),\n ];\n}\n\ninterface Citation {\n where: string;\n number: number;\n}\n\nfunction citationsIn(tree: Tree, file: string): Citation[] {\n const source = read(tree, file);\n return [...source.matchAll(CITATION)].map((match) => ({\n where: `${file}:${lineOf(source, match.index)}`,\n number: Number(match[1]),\n }));\n}\n\n/** A row may cite another row. The retired list and the prose around the rows are not held. */\nfunction citationsInRows(register: Register): Citation[] {\n return register.rows.flatMap((row) =>\n numbersIn(row.text.slice(row.text.indexOf(\"**\", 4) + 2)).map((number) => ({\n where: `${register.path}:${row.line}`,\n number,\n })),\n );\n}\n\nfunction citationFaults(register: Register, citations: readonly Citation[]): string[] {\n return citations.flatMap(({ where, number }) => {\n if (register.live.has(number)) return [];\n return register.retired.has(number)\n ? [`${where} cites D${number}, which is retired`]\n : [`${where} cites D${number}, which the register has no row for`];\n });\n}\n\nfunction isUnder(path: string, base: string): boolean {\n return base === \"\" || path === base || path.startsWith(`${base}/`);\n}\n\n/** `package-lock.json`, `pnpm-lock.yaml`: generated, and full of hashes that read like numbers. */\nconst LOCKFILE = /[-_.]lock\\.(?:json|jsonc|ya?ml)$/;\n\ninterface Named {\n path: string;\n /** How the path came to be named, for the fault. */\n by: string;\n want: Kind;\n}\n\nfunction allNamed(by: string, paths: readonly string[], want: Kind): Named[] {\n return paths.map((path) => ({ path: normal(path), by, want }));\n}\n\nfunction namedOr(option: string, path: string | undefined, fallback: string, want: Kind): Named {\n return path === undefined\n ? { path: fallback, by: `the default of \\`${option}\\``, want }\n : { path: normal(path), by: `named by \\`${option}\\``, want };\n}\n\nfunction namedFault(tree: Tree, named: Named): string[] {\n const kind = kindOf(tree, named.path);\n if (kind === named.want) return [];\n const shown = named.path === \"\" ? \".\" : named.path;\n return [`${shown}, ${named.by}, is ${kind === \"absent\" ? \"not there\" : `not a ${named.want}`}`];\n}\n\nfunction usable(tree: Tree, named: readonly Named[]): string[] {\n return named.flatMap((one) => (kindOf(tree, one.path) === one.want ? [one.path] : []));\n}\n\nconst NO_FAULTS: RepoFaults = { scans: [], links: [], register: [], citations: [], research: [] };\n\nexport function checkRepo(config: RepoConfig): RepoFaults {\n const leftOut = Object.keys(config.leftOut ?? {}).map(normal);\n const tree: Tree = {\n root: resolve(config.root),\n skip: new Set([...DEFAULT_SKIP, ...(config.skip ?? [])]),\n leftOut: new Set(leftOut),\n extensions: config.extensions ?? DEFAULT_EXTENSIONS,\n broken: new Set(),\n };\n if (kindOf(tree, \"\") !== \"directory\") {\n return { ...NO_FAULTS, scans: [`${tree.root}, named by \\`root\\`, is not a directory`] };\n }\n\n const docs = namedOr(\"docs\", config.docs, \"docs\", \"directory\");\n const registerAt = namedOr(\"register\", config.register, child(docs.path, \"decisions.md\"), \"file\");\n const research = namedOr(\"research\", config.research, \"_research\", \"directory\");\n const codeRoots = allNamed(\"named by `codeRoots`\", config.codeRoots, \"directory\");\n const documents =\n config.documents === undefined\n ? allNamed(\"a default of `documents`\", DEFAULT_DOCUMENTS, \"file\")\n : allNamed(\"named by `documents`\", config.documents, \"file\");\n const linked = allNamed(\"named by `linked`\", config.linked ?? [], \"file\");\n\n // A repo has no research until its first, so an absent directory is not a fault.\n const researchKind = kindOf(tree, research.path);\n const entries = (researchKind === \"directory\" ? names(tree, research.path) : []).flatMap(\n (name) => {\n const path = child(research.path, name);\n const kind = kindOf(tree, path);\n if (kind === \"absent\") tree.broken.add(path);\n return kind === \"absent\" ? [] : [{ path, name, folder: kind === \"directory\" }];\n },\n );\n\n // Inside the research only a folder's README is held: an entry is frozen once it is on the\n // main branch, so its body names paths and numbers as they stood, and some have moved since.\n const frozen = (file: string): boolean => isUnder(file, research.path);\n\n const living = [\n ...usable(tree, documents),\n ...walk(tree, docs.path).filter((file) => file.endsWith(\".md\") && !frozen(file)),\n ...usable(tree, linked),\n ];\n const linking = new Set([\n ...living,\n ...entries.flatMap((entry) => {\n const readme = `${entry.path}/README.md`;\n return entry.folder && kindOf(tree, readme) === \"file\" ? [readme] : [];\n }),\n ]);\n\n const scanned = usable(tree, codeRoots).map((base) => ({\n base,\n files: walk(tree, base).filter((file) => hasExtension(file, tree.extensions)),\n }));\n const atRoot = names(tree, \"\").filter(\n (name) =>\n hasExtension(name, tree.extensions) &&\n !tree.skip.has(name) &&\n !tree.leftOut.has(name) &&\n kindOf(tree, name) === \"file\",\n );\n const citing = [\n ...new Set([...living, ...scanned.flatMap((scan) => scan.files), ...atRoot]),\n ].filter((file) => file !== registerAt.path && !frozen(file) && !LOCKFILE.test(file));\n\n // With no register to read, every citation would fail: `scans` says so once instead.\n const held = kindOf(tree, registerAt.path) === \"file\";\n const register = readRegister(tree, registerAt.path);\n const wrongKind = researchKind === \"file\" ? namedFault(tree, research) : [];\n const leftOutFaults = leftOut.flatMap((path) =>\n kindOf(tree, path) === \"absent\" ? [`${path}, named by \\`leftOut\\`, is not there`] : [],\n );\n\n return {\n scans: [\n ...[...codeRoots, ...documents, docs, registerAt, ...linked].flatMap((one) =>\n namedFault(tree, one),\n ),\n ...wrongKind,\n ...leftOutFaults,\n ...scanned.flatMap((scan) =>\n scan.files.length === 0\n ? [`${scan.base === \"\" ? \".\" : scan.base} holds no file to scan for decision numbers`]\n : [],\n ),\n ...(held && register.rows.length === 0 ? [`${registerAt.path} holds no row`] : []),\n ...[...tree.broken].toSorted().map((path) => `${path} is a symbolic link that leads nowhere`),\n ],\n links: linkFaults(\n tree,\n [...linking].flatMap((file) => linksIn(tree, file)),\n ),\n register: held ? registerFaults(register) : [],\n citations: held\n ? citationFaults(register, [\n ...citing.flatMap((file) => citationsIn(tree, file)),\n ...citationsInRows(register),\n ])\n : [],\n research: researchFaults(tree, entries),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA8CA,MAAa,SAAS;CAAC;CAAS;CAAS;CAAY;CAAa;AAAU;;AAQ5E,MAAa,SAAS;CACpB,OAAO;CACP,OAAO;CACP,UAAU;CACV,WAAW;CACX,UAAU;AACZ;;AAGA,MAAa,QAAQ;CACnB,OACE;CAEF,OAAO;CACP,UACE;CAEF,WACE;CAGF,UACE;AAEJ;AAEA,MAAa,oBAAuC;CAAC;CAAa;CAAa;AAAY;AAE3F,MAAa,qBAAwC;CACnD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;AAGA,MAAa,eAAkC;CAAC;CAAgB;CAAc;AAAM;AAapF,SAAS,OAAO,MAAY,MAAoB;CAC9C,IAAI;EACF,OAAO,SAAS,KAAK,KAAK,MAAM,IAAI,CAAC,CAAC,CAAC,YAAY,IAAI,cAAc;CACvE,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,eAAe,MAAY,MAAuB;CACzD,IAAI;EACF,OAAO,UAAU,KAAK,KAAK,MAAM,IAAI,CAAC,CAAC,CAAC,eAAe;CACzD,QAAQ;EACN,OAAO;CACT;AACF;AAGA,SAAS,KAAK,MAAY,MAAsB;CAC9C,OAAO,aAAa,KAAK,KAAK,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AAI,MAAM;CAC/C,MAAM,WAAW,aAAa,MAAM,WAAW,IAAI;CACnD,MAAM,YAAY,iBAAiB,SAAS,WAAW,MAAM,QAAQ,IAAI,CAAC;CAC1E,MAAM,gBAAgB,QAAQ,SAAS,SACrC,OAAO,MAAM,IAAI,MAAM,WAAW,CAAC,GAAG,KAAK,qCAAqC,IAAI,CAAC,CACvF;CAEA,OAAO;EACL,OAAO;GACL,GAAG;IAAC,GAAG;IAAW,GAAG;IAAW;IAAM;IAAY,GAAG;GAAM,CAAC,CAAC,SAAS,QACpE,WAAW,MAAM,GAAG,CACtB;GACA,GAAG;GACH,GAAG;GACH,GAAG,QAAQ,SAAS,SAClB,KAAK,MAAM,WAAW,IAClB,CAAC,GAAG,KAAK,SAAS,KAAK,MAAM,KAAK,KAAK,4CAA4C,IACnF,CAAC,CACP;GACA,GAAI,QAAQ,SAAS,KAAK,WAAW,IAAI,CAAC,GAAG,WAAW,KAAK,cAAc,IAAI,CAAC;GAChF,GAAG,CAAC,GAAG,KAAK,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,SAAS,GAAG,KAAK,uCAAuC;EAC9F;EACA,OAAO,WACL,MACA,CAAC,GAAG,OAAO,CAAC,CAAC,SAAS,SAAS,QAAQ,MAAM,IAAI,CAAC,CACpD;EACA,UAAU,OAAO,eAAe,QAAQ,IAAI,CAAC;EAC7C,WAAW,OACP,eAAe,UAAU,CACvB,GAAG,OAAO,SAAS,SAAS,YAAY,MAAM,IAAI,CAAC,GACnD,GAAG,gBAAgB,QAAQ,CAC7B,CAAC,IACD,CAAC;EACL,UAAU,eAAe,MAAM,OAAO;CACxC;AACF"}
|
package/dist/verify.d.mts
CHANGED
|
@@ -1,92 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Proof that every lint rule still fires.
|
|
4
|
-
*
|
|
5
|
-
* The linter lives inside the `vp` binary, so it moves independently of any
|
|
6
|
-
* lockfile, and the JS-plugin bridge it loads these rules through is alpha. A
|
|
7
|
-
* rule can stop firing with no diff anywhere, and a dead lint rule is silent:
|
|
8
|
-
* "reports nothing" looks exactly like "no violations". This is the thing that
|
|
9
|
-
* notices.
|
|
10
|
-
*
|
|
11
|
-
* A suite is a directory holding one deliberately-broken `<rule>.fixture.ts(x)`
|
|
12
|
-
* per rule. The check asserts a positive: every rule fired, each on the file
|
|
13
|
-
* named after it.
|
|
14
|
-
*
|
|
15
|
-
* Run the package's own suite from a consumer's repo root:
|
|
16
|
-
*
|
|
17
|
-
* npx rdjperron-lint-verify
|
|
18
|
-
*
|
|
19
|
-
* ---------------------------------------------------------------------------
|
|
20
|
-
* Why the symlink dance
|
|
21
|
-
* ---------------------------------------------------------------------------
|
|
22
|
-
* The fixtures ship inside `node_modules`, which oxlint never walks, and a
|
|
23
|
-
* consumer's own fixture directories are usually in `lint.ignorePatterns` so a
|
|
24
|
-
* plain `vp check` stays quiet. Measured on Vite+ 0.2.9 / oxlint 1.77.0 and
|
|
25
|
-
* again on 0.3.1 / oxlint 1.81.0: no flag re-includes an ignored path.
|
|
26
|
-
* `--no-ignore`, `--ignore-pattern '!<dir>/**'`, an explicit file, an absolute
|
|
27
|
-
* path, a cwd inside the directory and `-W <rule>` all answer "No files found
|
|
28
|
-
* to lint." `--no-ignore` only disables `.eslintignore`, `--ignore-path` and
|
|
29
|
-
* `--ignore-pattern`; it does not touch the config's own `ignorePatterns`, and
|
|
30
|
-
* `vp lint` has no `--config` flag.
|
|
31
|
-
*
|
|
32
|
-
* What does work: oxlint matches ignore patterns against the path it walked,
|
|
33
|
-
* not the realpath. Linting through a symlink outside the ignored prefix
|
|
34
|
-
* reaches the fixtures normally, plugin and all. This creates that view per
|
|
35
|
-
* suite, lints through it, and removes it in a `finally`.
|
|
36
|
-
*
|
|
37
|
-
* The severities cannot come from the command line either: `-A`, `-W` and `-D`
|
|
38
|
-
* reach built-in rules only and leave every JS plugin rule exactly as the config
|
|
39
|
-
* left it (measured on vite-plus 0.3.1 / oxlint 1.81.0, with `vp lint` and with
|
|
40
|
-
* the bare binary). That is why the consumer's config must carry the
|
|
41
|
-
* `fixtures()` override from `@rdjperron/lint/config`.
|
|
42
|
-
*/
|
|
43
|
-
export interface Suite {
|
|
44
|
-
/** The plugin alias the diagnostics carry, e.g. `rdjperron` in `rdjperron(no-reflect-get)`. */
|
|
45
|
-
plugin: string;
|
|
46
|
-
/** The fixture directory, relative to `root`. */
|
|
47
|
-
fixtureDir: string;
|
|
48
|
-
/** Where the un-ignored view is created, relative to `root`. */
|
|
49
|
-
viewDir: string;
|
|
50
|
-
/** Fixture file endings; the part before one of them is the rule name. */
|
|
51
|
-
suffixes?: string[];
|
|
52
|
-
/** Skip the direct path and always lint through the view (fixtures under `node_modules`). */
|
|
53
|
-
alwaysView?: boolean;
|
|
54
|
-
/** Advisory: the rule names the plugin registers, so a new rule without a fixture is named. */
|
|
55
|
-
registeredRules?: () => Promise<string[] | null>;
|
|
56
|
-
/** Where the failure message sends the reader. */
|
|
57
|
-
readme?: string;
|
|
58
|
-
}
|
|
59
|
-
export interface VerifyOptions {
|
|
60
|
-
/** The repo root the paths are relative to and `vp lint` runs from. Defaults to the cwd. */
|
|
61
|
-
root?: string;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Locate the `vp` binary: PATH first, then the default install locations, the
|
|
65
|
-
* XDG layout used since Vite+ 0.3.0 and the pre-0.3.0 single-root layout that
|
|
66
|
-
* upgraded installs keep.
|
|
67
|
-
*/
|
|
68
|
-
export declare function resolveViteplusBinary(): string;
|
|
69
|
-
/**
|
|
70
|
-
* Lint every suite and print one table each. Returns the number of rules that
|
|
71
|
-
* did not fire, so zero means every rule of every suite is alive.
|
|
72
|
-
*/
|
|
73
|
-
export declare function verifySuites(suites: Suite[], options?: VerifyOptions): Promise<number>;
|
|
74
|
-
/**
|
|
75
|
-
* Two promises about the plugin API, held here as a failure instead.
|
|
76
|
-
*
|
|
77
|
-
* - the installed `@oxlint/plugins` is the exact version `vite-plus` declares;
|
|
78
|
-
* - this package's peer range accepts that version.
|
|
79
|
-
*
|
|
80
|
-
* The rules import `@oxlint/plugins`, so the installed one must be the one the
|
|
81
|
-
* linter was built against, or the rules compile against one plugin API and run
|
|
82
|
-
* under another with no error anywhere. Returns the failures, empty when the
|
|
83
|
-
* pins agree or when `vite-plus` is not installed (a consumer on another
|
|
84
|
-
* toolchain has nothing to pin against).
|
|
85
|
-
*/
|
|
86
|
-
export declare function verifyPluginApiPin(root?: string): string[];
|
|
87
|
-
/** The suite for this package's own fixtures, as they sit in a consumer's `node_modules`. */
|
|
88
|
-
export declare function packageSuite(root?: string): Suite;
|
|
89
|
-
/** The bin: this package's suite, plus the plugin API pin, from the consumer's repo root. */
|
|
90
|
-
export declare function main(root?: string): Promise<number>;
|
|
91
|
-
//#endregion
|
|
92
|
-
//# sourceMappingURL=verify.d.mts.map
|
|
1
|
+
export {}
|