paperlint 20.0.0 → 20.1.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/.claude-plugin/plugin.json +1 -1
- package/dist/cli.d.ts +7 -4
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +36 -19
- package/dist/cli.js.map +1 -1
- package/dist/domain/paper-folder.d.ts.map +1 -1
- package/dist/domain/paper-folder.js +4 -0
- package/dist/domain/paper-folder.js.map +1 -1
- package/dist/domain/paper-stage.d.ts +20 -0
- package/dist/domain/paper-stage.d.ts.map +1 -0
- package/dist/domain/paper-stage.js +9 -0
- package/dist/domain/paper-stage.js.map +1 -0
- package/dist/eslint-rules/CLAUDE.md.spec.d.ts.map +1 -1
- package/dist/eslint-rules/CLAUDE.md.spec.js +1 -0
- package/dist/eslint-rules/CLAUDE.md.spec.js.map +1 -1
- package/dist/hook-counts.d.ts +30 -0
- package/dist/hook-counts.d.ts.map +1 -0
- package/dist/hook-counts.js +35 -0
- package/dist/hook-counts.js.map +1 -0
- package/dist/hooks-settings.d.ts +8 -10
- package/dist/hooks-settings.d.ts.map +1 -1
- package/dist/hooks-settings.js +31 -35
- package/dist/hooks-settings.js.map +1 -1
- package/dist/lint-edited-block.d.ts +8 -0
- package/dist/lint-edited-block.d.ts.map +1 -0
- package/dist/lint-edited-block.js +30 -0
- package/dist/lint-edited-block.js.map +1 -0
- package/dist/lint-edited-hook.d.ts +5 -6
- package/dist/lint-edited-hook.d.ts.map +1 -1
- package/dist/lint-edited-hook.js +47 -25
- package/dist/lint-edited-hook.js.map +1 -1
- package/dist/lint-edited-shell.d.ts +15 -0
- package/dist/lint-edited-shell.d.ts.map +1 -0
- package/dist/lint-edited-shell.js +49 -0
- package/dist/lint-edited-shell.js.map +1 -0
- package/dist/paper-files.d.ts +2 -1
- package/dist/paper-files.d.ts.map +1 -1
- package/dist/paper-files.js +1 -0
- package/dist/paper-files.js.map +1 -1
- package/dist/rules-config.d.ts +6 -0
- package/dist/rules-config.d.ts.map +1 -1
- package/dist/rules-config.js.map +1 -1
- package/dist/settled-paper.d.ts +6 -0
- package/dist/settled-paper.d.ts.map +1 -0
- package/dist/settled-paper.js +69 -0
- package/dist/settled-paper.js.map +1 -0
- package/docs/configuration.md +17 -3
- package/docs/e2e.md +1 -1
- package/docs/layout.md +19 -4
- package/docs/rules/paper/edition-over.md +4 -3
- package/eslint-rules/CLAUDE.md +5 -1
- package/eslint-rules/CLAUDE.md.spec.ts +3 -0
- package/package.json +1 -1
- package/plugin/hooks/hooks.json +11 -0
- package/src/cli.ts +44 -22
- package/src/doctor.test.ts +23 -6
- package/src/domain/paper-folder.ts +3 -0
- package/src/domain/paper-stage.ts +25 -0
- package/src/hook-counts.test.ts +67 -0
- package/src/hook-counts.ts +64 -0
- package/src/hooks-settings.harness.ts +15 -18
- package/src/hooks-settings.ts +43 -49
- package/src/init-plugin.test.ts +8 -2
- package/src/lint-edited-bash.test.ts +324 -0
- package/src/lint-edited-block.ts +44 -0
- package/src/lint-edited-hook.test.ts +10 -11
- package/src/lint-edited-hook.ts +72 -35
- package/src/lint-edited-shell.ts +72 -0
- package/src/paper-files.ts +8 -1
- package/src/paper-settings-commands.test.ts +13 -16
- package/src/rules-config.ts +8 -0
- package/src/settled-paper.test.ts +214 -0
- package/src/settled-paper.ts +78 -0
package/src/paper-files.ts
CHANGED
|
@@ -41,7 +41,12 @@
|
|
|
41
41
|
* - `files: [["a", "b"]]` matches a file only when BOTH patterns match.
|
|
42
42
|
*/
|
|
43
43
|
import { relative, sep } from "node:path";
|
|
44
|
-
import type {
|
|
44
|
+
import type {
|
|
45
|
+
ConfigBlock,
|
|
46
|
+
RuleBlock,
|
|
47
|
+
RuleEntry,
|
|
48
|
+
StageLinterOptions,
|
|
49
|
+
} from "./rules-config.ts";
|
|
45
50
|
|
|
46
51
|
/**
|
|
47
52
|
* Which papers' own files paperlint's blocks claim. `any` is the config's SHAPE, for the rule list and
|
|
@@ -122,6 +127,7 @@ export interface ScopedBlock {
|
|
|
122
127
|
readonly basePath: string;
|
|
123
128
|
readonly files?: readonly FilesEntry[];
|
|
124
129
|
readonly ignores?: readonly string[];
|
|
130
|
+
readonly linterOptions?: StageLinterOptions;
|
|
125
131
|
readonly rules: Readonly<Record<string, RuleEntry>>;
|
|
126
132
|
}
|
|
127
133
|
|
|
@@ -276,6 +282,7 @@ function within(
|
|
|
276
282
|
basePath: block.basePath,
|
|
277
283
|
files,
|
|
278
284
|
...(ignores.length ? { ignores } : {}),
|
|
285
|
+
...(block.linterOptions ? { linterOptions: block.linterOptions } : {}),
|
|
279
286
|
rules,
|
|
280
287
|
},
|
|
281
288
|
];
|
|
@@ -232,23 +232,20 @@ describe("paperlint lint — the venue preset's rules", () => {
|
|
|
232
232
|
const cfgOf = await import("./cli.ts").then((m) =>
|
|
233
233
|
m.paperRuleBlocks([join(root, "papers")]),
|
|
234
234
|
);
|
|
235
|
-
expect(cfgOf.ok && cfgOf.value).toEqual(
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
"
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
],
|
|
247
|
-
},
|
|
235
|
+
expect(cfgOf.ok && cfgOf.value.preset).toEqual([
|
|
236
|
+
{
|
|
237
|
+
// Scoped to the paper by `basePath` alone: which of its files the rule reaches is decided
|
|
238
|
+
// once, by narrowing to paperlint's owned scopes (#101), not by a copy of their globs.
|
|
239
|
+
basePath: join(root, "papers/a"),
|
|
240
|
+
rules: {
|
|
241
|
+
"pdf/last-page-balance": ["error", { tolerancePt: 120 }],
|
|
242
|
+
"tex/heading-case": [
|
|
243
|
+
"error",
|
|
244
|
+
{ title: "chicago-headline", headings: "chicago-headline" },
|
|
245
|
+
],
|
|
248
246
|
},
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
});
|
|
247
|
+
},
|
|
248
|
+
]);
|
|
252
249
|
});
|
|
253
250
|
|
|
254
251
|
it("🔴 an unbuilt agenticdev paper: two warnings (pdf/measured, paper/sources-fresh), and no balance error", async () => {
|
package/src/rules-config.ts
CHANGED
|
@@ -32,11 +32,19 @@ import { RULE_SETS, setMembers } from "./rule-sets.ts";
|
|
|
32
32
|
export type Severity = "off" | "warn" | "error" | 0 | 1 | 2;
|
|
33
33
|
export type RuleEntry = Severity | readonly [Severity, ...unknown[]];
|
|
34
34
|
|
|
35
|
+
/** The one linter option paperlint's own blocks set: a final paper's disable comments are not "unused". */
|
|
36
|
+
// A type, not an interface: it must be assignable to `ConfigBlock`'s record of linter options.
|
|
37
|
+
export type StageLinterOptions = Readonly<{
|
|
38
|
+
reportUnusedDisableDirectives: "off";
|
|
39
|
+
}>;
|
|
40
|
+
|
|
35
41
|
/** One block of the `rules` key, parsed. `basePath` is the settings file's directory. */
|
|
36
42
|
export interface RuleBlock {
|
|
37
43
|
readonly basePath: string;
|
|
38
44
|
readonly files?: readonly string[];
|
|
39
45
|
readonly ignores?: readonly string[];
|
|
46
|
+
/** Set only by paperlint's own blocks (a paper's stage); `paperlint.json` cannot write it. */
|
|
47
|
+
readonly linterOptions?: StageLinterOptions;
|
|
40
48
|
readonly rules: Readonly<Record<string, RuleEntry>>;
|
|
41
49
|
}
|
|
42
50
|
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A paper's stage, read from its `cycles` and `versions/lock.json`, adds rule blocks after its venue
|
|
3
|
+
* preset's (#583, #553): the rules stay what they are, the config decides where they run.
|
|
4
|
+
*/
|
|
5
|
+
import assert from "node:assert/strict";
|
|
6
|
+
import { readFileSync } from "node:fs";
|
|
7
|
+
import { join } from "node:path";
|
|
8
|
+
import { test } from "vitest";
|
|
9
|
+
import { useTempDir, writeTree } from "../test/support.ts";
|
|
10
|
+
import { paperRuleBlocks, run } from "./cli.ts";
|
|
11
|
+
import { currentCycle, parseCycles } from "./domain/cycle.ts";
|
|
12
|
+
import { paperStage } from "./domain/paper-stage.ts";
|
|
13
|
+
import { lockText } from "./domain/versions.ts";
|
|
14
|
+
|
|
15
|
+
const root = useTempDir("settled-paper-");
|
|
16
|
+
|
|
17
|
+
const CYCLE = {
|
|
18
|
+
id: "alpha-2026",
|
|
19
|
+
venue: { kind: "named", name: "Alpha 2026", url: "https://alpha.example" },
|
|
20
|
+
opened: "2026-07-01",
|
|
21
|
+
submission: { id: 3 },
|
|
22
|
+
};
|
|
23
|
+
const OPEN = { ...CYCLE, outcome: { kind: "open" } };
|
|
24
|
+
const ACCEPTED = {
|
|
25
|
+
...CYCLE,
|
|
26
|
+
outcome: { kind: "accepted", date: "2026-08-21", evidence: "m.eml" },
|
|
27
|
+
};
|
|
28
|
+
const REJECTED = {
|
|
29
|
+
...CYCLE,
|
|
30
|
+
outcome: {
|
|
31
|
+
kind: "rejected",
|
|
32
|
+
date: "2026-08-21",
|
|
33
|
+
evidence: "m.eml",
|
|
34
|
+
desk: true,
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
const FROZEN = {
|
|
38
|
+
kind: "file" as const,
|
|
39
|
+
bytes: 4,
|
|
40
|
+
sha256: "0".repeat(64),
|
|
41
|
+
frozen: "2026-08-29",
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/** One paper: its cycles, and the lock entries of its frozen files. */
|
|
45
|
+
function paper(
|
|
46
|
+
name: string,
|
|
47
|
+
cycles: readonly object[],
|
|
48
|
+
frozen: readonly string[],
|
|
49
|
+
): string {
|
|
50
|
+
const dir = writeTree(join(root, name), {
|
|
51
|
+
"p/paper.tex": "% p\n",
|
|
52
|
+
"p/PIPELINE-STATUS.md": "# status\n",
|
|
53
|
+
"p/paperlint.json": JSON.stringify({ cycles }),
|
|
54
|
+
"p/versions/lock.json": lockText(
|
|
55
|
+
Object.fromEntries(frozen.map((k) => [k, FROZEN])),
|
|
56
|
+
),
|
|
57
|
+
});
|
|
58
|
+
return join(dir, "p");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** The blocks the paper's stage adds. */
|
|
62
|
+
function stageBlocks(dir: string) {
|
|
63
|
+
const r = paperRuleBlocks([dir]);
|
|
64
|
+
assert.ok(r.ok, r.ok ? "" : r.error);
|
|
65
|
+
return r.value.stage;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const off = (b: { readonly rules: Readonly<Record<string, unknown>> }) =>
|
|
69
|
+
Object.entries(b.rules).filter(([, v]) => v === "off");
|
|
70
|
+
|
|
71
|
+
test("a final paper — accepted, camera-ready frozen — turns its text and build rules off, keeps its record rules, and edition-over goes", () => {
|
|
72
|
+
const dir = paper("final", [ACCEPTED], ["alpha-2026/camera-ready.pdf"]);
|
|
73
|
+
const blocks = stageBlocks(dir);
|
|
74
|
+
const tex = blocks.find((b) => b.files?.includes("**/*.tex"));
|
|
75
|
+
assert.ok(tex, JSON.stringify(blocks));
|
|
76
|
+
assert.equal(tex.basePath, dir);
|
|
77
|
+
const texOff = new Set(off(tex).map(([id]) => id));
|
|
78
|
+
for (const id of ["pdf/fresh", "pdf/last-page-balance", "pdf/measured"])
|
|
79
|
+
assert.ok(texOff.has(id), id);
|
|
80
|
+
// The record of attempts is what a final paper is judged on: whether its camera-ready came from
|
|
81
|
+
// what was accepted.
|
|
82
|
+
for (const id of ["tex/max-sentence-words", "bib/reachable-entry"])
|
|
83
|
+
assert.ok(texOff.has(id), id);
|
|
84
|
+
// What is still delivered after the camera-ready (the talk, the public artifact) and the records
|
|
85
|
+
// (attempts, the lock, the study) keep their rules: freezing the PDF says nothing about them.
|
|
86
|
+
for (const id of [
|
|
87
|
+
"cycle/camera-ready-source",
|
|
88
|
+
"cycle/draft-drift",
|
|
89
|
+
"talk/required-files",
|
|
90
|
+
"artifact/upload-current",
|
|
91
|
+
"versions/layout",
|
|
92
|
+
"repro/study-result",
|
|
93
|
+
])
|
|
94
|
+
assert.ok(!texOff.has(id), id);
|
|
95
|
+
assert.deepEqual(
|
|
96
|
+
blocks.filter((b) => b.files === undefined).map((b) => b.rules),
|
|
97
|
+
[{ "paper/edition-over": "off" }],
|
|
98
|
+
);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
test("an accepted paper whose camera-ready is not frozen keeps its build rules; only edition-over goes", () => {
|
|
102
|
+
const dir = paper("camera-ready", [ACCEPTED], []);
|
|
103
|
+
assert.deepEqual(stageBlocks(dir), [
|
|
104
|
+
{ basePath: dir, rules: { "paper/edition-over": "off" } },
|
|
105
|
+
]);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
test("an open or rejected paper — still being written — adds no block", () => {
|
|
109
|
+
assert.deepEqual(stageBlocks(paper("open", [OPEN], [])), []);
|
|
110
|
+
assert.deepEqual(
|
|
111
|
+
stageBlocks(paper("rejected", [REJECTED], ["alpha-2026/camera-ready.pdf"])),
|
|
112
|
+
[],
|
|
113
|
+
);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
test("no cycles, or a lock that is missing or not JSON, is not a final paper", () => {
|
|
117
|
+
const dir = writeTree(join(root, "unlocked"), {
|
|
118
|
+
"none/paper.tex": "% p\n",
|
|
119
|
+
"missing/paper.tex": "% p\n",
|
|
120
|
+
"missing/paperlint.json": JSON.stringify({ cycles: [ACCEPTED] }),
|
|
121
|
+
"broken/paper.tex": "% p\n",
|
|
122
|
+
"broken/paperlint.json": JSON.stringify({ cycles: [ACCEPTED] }),
|
|
123
|
+
"broken/versions/lock.json": "{ not json",
|
|
124
|
+
});
|
|
125
|
+
assert.deepEqual(stageBlocks(join(dir, "none")), []);
|
|
126
|
+
for (const name of ["missing", "broken"])
|
|
127
|
+
assert.deepEqual(stageBlocks(join(dir, name)), [
|
|
128
|
+
{ basePath: join(dir, name), rules: { "paper/edition-over": "off" } },
|
|
129
|
+
]);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
test("paperStage: working, accepted, final", () => {
|
|
133
|
+
const parsed = parseCycles([ACCEPTED]);
|
|
134
|
+
assert.ok(parsed.ok && parsed.value !== null);
|
|
135
|
+
const current = currentCycle(parsed.value);
|
|
136
|
+
assert.ok(current.ok);
|
|
137
|
+
const frozen = { "alpha-2026/camera-ready.pdf": FROZEN };
|
|
138
|
+
assert.equal(paperStage(current.value, frozen), "final");
|
|
139
|
+
assert.equal(paperStage(current.value, {}), "accepted");
|
|
140
|
+
assert.equal(paperStage({ kind: "none" }, frozen), "working");
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
/** `paperlint lint [flags] papers/p` in `cwd`: its exit code and what it printed. */
|
|
144
|
+
async function lint(cwd: string, ...flags: readonly string[]) {
|
|
145
|
+
const out: string[] = [];
|
|
146
|
+
const code = await run(["lint", ...flags, "papers/p"], {
|
|
147
|
+
log: (...a: unknown[]) => out.push(a.join(" ")),
|
|
148
|
+
err: (...a: unknown[]) => out.push(a.join(" ")),
|
|
149
|
+
cwd,
|
|
150
|
+
now: () => 0,
|
|
151
|
+
install: {
|
|
152
|
+
command: (_r, spec) => ["npm", spec],
|
|
153
|
+
run: () => ({ ok: true }),
|
|
154
|
+
},
|
|
155
|
+
claude: {
|
|
156
|
+
present: () => false,
|
|
157
|
+
plugin: () => ({ enabled: false, version: null }),
|
|
158
|
+
enable: () => assert.fail("lint does not touch the plugin"),
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
return { code, out: out.join("\n") };
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const LONG = Array.from({ length: 70 }, () => "word").join(" ");
|
|
165
|
+
const TEX = `\\documentclass{article}\n\\begin{document}\n${LONG}.\n\\end{document}\n`;
|
|
166
|
+
const ON = { "tex/max-sentence-words": "warn" };
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* A project with one paper whose text has a 70-word sentence. `at: "root"` turns the writing rule on
|
|
170
|
+
* for every paper by a glob in the ROOT paperlint.json; `at: "own"` in the paper's own.
|
|
171
|
+
*/
|
|
172
|
+
function project(
|
|
173
|
+
name: string,
|
|
174
|
+
cycles: readonly object[],
|
|
175
|
+
at: "root" | "own" = "root",
|
|
176
|
+
tex: string = TEX,
|
|
177
|
+
): string {
|
|
178
|
+
const rootRules =
|
|
179
|
+
at === "root" ? [{ files: ["papers/*/paper.tex"], rules: ON }] : [];
|
|
180
|
+
return writeTree(join(root, name), {
|
|
181
|
+
"package.json": "{}",
|
|
182
|
+
"paperlint.json": JSON.stringify({ papersDir: "papers", rules: rootRules }),
|
|
183
|
+
"papers/p/PIPELINE-STATUS.md": "# status\n",
|
|
184
|
+
"papers/p/paper.tex": tex,
|
|
185
|
+
"papers/p/paperlint.json": JSON.stringify(
|
|
186
|
+
at === "own" ? { cycles, rules: ON } : { cycles },
|
|
187
|
+
),
|
|
188
|
+
"papers/p/versions/lock.json": lockText({
|
|
189
|
+
"alpha-2026/camera-ready.pdf": FROZEN,
|
|
190
|
+
}),
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
test("lint: the root's glob reaches a paper being written, and not a final one — the stage comes after the root", async () => {
|
|
195
|
+
const open = await lint(project("lint-open", [OPEN]));
|
|
196
|
+
assert.match(open.out, /tex\/max-sentence-words/);
|
|
197
|
+
const final = await lint(project("lint-final", [ACCEPTED]));
|
|
198
|
+
assert.doesNotMatch(final.out, /max-sentence-words/);
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
test("lint: a writing rule the paper turns on in its OWN settings is off on a final paper too — the stage comes last", async () => {
|
|
202
|
+
const open = await lint(project("own-open", [OPEN], "own"));
|
|
203
|
+
assert.match(open.out, /tex\/max-sentence-words/);
|
|
204
|
+
const final = await lint(project("own-final", [ACCEPTED], "own"));
|
|
205
|
+
assert.doesNotMatch(final.out, /max-sentence-words/);
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
test("lint --fix: a disable comment on a final paper is not reported unused, and the published text is not rewritten", async () => {
|
|
209
|
+
const tex = `\\documentclass{article}\n\\begin{document}\n% eslint-disable-next-line tex/max-sentence-words\n${LONG}.\n\\end{document}\n`;
|
|
210
|
+
const dir = project("directive-final", [ACCEPTED], "root", tex);
|
|
211
|
+
const r = await lint(dir, "--fix");
|
|
212
|
+
assert.doesNotMatch(r.out, /[Uu]nused eslint-disable/);
|
|
213
|
+
assert.equal(readFileSync(join(dir, "papers/p/paper.tex"), "utf8"), tex);
|
|
214
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The rule blocks a paper's stage adds (#583, #553).
|
|
3
|
+
*
|
|
4
|
+
* A rule judges its own subject and knows nothing about where a paper is in its life. Whether it
|
|
5
|
+
* should run on a paper that is done is a question about WHICH FILES a rule runs on, and in ESLint
|
|
6
|
+
* that is the config's question. So the stage (`src/domain/paper-stage.ts`) becomes blocks here, in
|
|
7
|
+
* the one place that already reads every paper's `paperlint.json` to build its blocks:
|
|
8
|
+
*
|
|
9
|
+
* accepted `paper/edition-over` off: the edition being over is where an accepted paper ends up
|
|
10
|
+
* final also every rule about the text and the build off on the paper's `.tex`: the published
|
|
11
|
+
* text and PDF are frozen in `versions/`, so "rebuild", "too long" or "not built yet" has
|
|
12
|
+
* nothing left to fix. The talk, the artifact and the records keep their rules
|
|
13
|
+
*
|
|
14
|
+
* The blocks go LAST, after the root `paperlint.json` and after the paper's own `rules`: a writing
|
|
15
|
+
* rule turned on while the paper was written, at either level, says nothing on its published text.
|
|
16
|
+
* Nothing turns a text rule back on for a final paper; the paper is worked on again in a new cycle,
|
|
17
|
+
* and an open cycle makes it `working`.
|
|
18
|
+
*/
|
|
19
|
+
import { paperStage } from "./domain/paper-stage.ts";
|
|
20
|
+
import type { Cycles } from "./domain/cycle.ts";
|
|
21
|
+
import type { Files } from "./ports/files.ts";
|
|
22
|
+
import type { RuleBlock } from "./rules-config.ts";
|
|
23
|
+
import { readLock } from "./versions.ts";
|
|
24
|
+
|
|
25
|
+
/** The paper's own `.tex` files: `paper.tex` and the files it includes. Relative to the paper. */
|
|
26
|
+
const PAPER_TEX = "**/*.tex";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The plugins whose rules judge the paper's TEXT and its BUILD: what the frozen camera-ready already
|
|
30
|
+
* fixed. Only these go off on a final paper. The rest stay on, because freezing the PDF says nothing
|
|
31
|
+
* about them: the talk and the public artifact are still being delivered (`talk/*`, `artifact/*`),
|
|
32
|
+
* and the records are what a final paper is judged on (`cycle/*`, `versions/*`, `repro/*`,
|
|
33
|
+
* `study/*`). A list of what goes off, not of what stays, so a new plugin stays on until someone
|
|
34
|
+
* decides it judges the frozen text.
|
|
35
|
+
*/
|
|
36
|
+
const FROZEN_TEXT_PLUGINS: readonly string[] = [
|
|
37
|
+
"tex",
|
|
38
|
+
"bib",
|
|
39
|
+
"pdf",
|
|
40
|
+
"format",
|
|
41
|
+
"anonymity",
|
|
42
|
+
"paper",
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
/** The blocks for the paper in `dir`, or none while it is being written. Reads the lock through `files`. */
|
|
46
|
+
export function stageBlocks(
|
|
47
|
+
dir: string,
|
|
48
|
+
cycles: Cycles | null,
|
|
49
|
+
files: Files,
|
|
50
|
+
shipped: ReadonlySet<string>,
|
|
51
|
+
): readonly RuleBlock[] {
|
|
52
|
+
if (cycles === null) return [];
|
|
53
|
+
const lock = readLock(dir, files);
|
|
54
|
+
const stage = paperStage(cycles.current, lock?.ok ? lock.value : {});
|
|
55
|
+
if (stage === "working") return [];
|
|
56
|
+
const accepted: RuleBlock = {
|
|
57
|
+
basePath: dir,
|
|
58
|
+
rules: { "paper/edition-over": "off" },
|
|
59
|
+
};
|
|
60
|
+
if (stage === "accepted") return [accepted];
|
|
61
|
+
const textOff = Object.fromEntries(
|
|
62
|
+
[...shipped]
|
|
63
|
+
.filter((id) => FROZEN_TEXT_PLUGINS.some((p) => id.startsWith(`${p}/`)))
|
|
64
|
+
.map((id) => [id, "off" as const]),
|
|
65
|
+
);
|
|
66
|
+
// A disable comment for a rule this block turns off suppresses nothing, and ESLint would report it
|
|
67
|
+
// as unused, and `--fix` would delete it from the published text: the trap `rulesOff` in cli.ts
|
|
68
|
+
// closes the same way.
|
|
69
|
+
return [
|
|
70
|
+
accepted,
|
|
71
|
+
{
|
|
72
|
+
basePath: dir,
|
|
73
|
+
files: [PAPER_TEX],
|
|
74
|
+
linterOptions: { reportUnusedDisableDirectives: "off" },
|
|
75
|
+
rules: textOff,
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
}
|