paperlint 17.0.0 → 17.2.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.md +2 -2
- package/README.md +22 -16
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +28 -29
- package/dist/cli.js.map +1 -1
- package/dist/folder-venue-rule.d.ts +1 -1
- package/dist/folder-venue-rule.d.ts.map +1 -1
- package/dist/folder-venue-rule.js +4 -2
- package/dist/folder-venue-rule.js.map +1 -1
- package/dist/presets.d.ts +21 -2
- package/dist/presets.d.ts.map +1 -1
- package/dist/presets.js +71 -17
- package/dist/presets.js.map +1 -1
- package/dist/register-bands.d.ts +1 -7
- package/dist/register-bands.d.ts.map +1 -1
- package/dist/register-bands.js +12 -19
- package/dist/register-bands.js.map +1 -1
- package/dist/rule-sets.d.ts +43 -0
- package/dist/rule-sets.d.ts.map +1 -0
- package/dist/rule-sets.js +59 -0
- package/dist/rule-sets.js.map +1 -0
- package/dist/rules-config.d.ts +2 -1
- package/dist/rules-config.d.ts.map +1 -1
- package/dist/rules-config.js +17 -3
- package/dist/rules-config.js.map +1 -1
- package/dist/tex-requirements.d.ts +2 -0
- package/dist/tex-requirements.d.ts.map +1 -1
- package/dist/tex-requirements.js +1 -0
- package/dist/tex-requirements.js.map +1 -1
- package/dist/tex-venue-rules.d.ts +2 -1
- package/dist/tex-venue-rules.d.ts.map +1 -1
- package/dist/tex-venue-rules.js +3 -2
- package/dist/tex-venue-rules.js.map +1 -1
- package/docs/configuration.md +9 -2
- package/docs/optional-rules.md +48 -6
- package/docs/rules/paper/folder-venue-leftover.md +10 -7
- package/docs/rules/tex/claim-emphasis.md +1 -1
- package/docs/rules/tex/claim-provenance.md +3 -3
- package/docs/rules/tex/contrast-frames.md +1 -1
- package/docs/rules/tex/max-caption-words.md +1 -1
- package/docs/rules/tex/max-paragraph-numbers.md +1 -1
- package/docs/rules/tex/max-paragraph-words.md +1 -1
- package/docs/rules/tex/max-sentence-words.md +1 -1
- package/docs/rules/tex/negated-sentences.md +1 -1
- package/docs/rules/tex/register.md +1 -1
- package/docs/rules/tex/relation-markers.md +1 -1
- package/docs/rules/tex/venue-leftover.md +13 -1
- package/docs/rules.md +21 -18
- package/fixtures/real-papers.test.ts +3 -0
- package/package.json +1 -1
- package/presets/acm-sigconf.md +1 -1
- package/presets/agenticdev.jsonc +5 -2
- package/presets/agenticdev.md +4 -2
- package/presets/aidc.jsonc +2 -1
- package/presets/aidc.md +4 -3
- package/presets/aisec.jsonc +9 -3
- package/presets/aisec.md +4 -1
- package/presets/ase.jsonc +145 -0
- package/presets/ase.md +178 -0
- package/presets/ccs.jsonc +87 -0
- package/presets/ccs.md +184 -0
- package/presets/icse.jsonc +100 -0
- package/presets/icse.md +126 -0
- package/presets/ieee-conference.md +1 -1
- package/presets/sp.jsonc +152 -0
- package/presets/sp.md +160 -0
- package/presets/venue-profile.schema.json +7 -2
- package/src/cli.harness.mjs +25 -5
- package/src/cli.ts +43 -30
- package/src/domain/venue-name.test.ts +4 -4
- package/src/folder-venue-rule.test.ts +23 -2
- package/src/folder-venue-rule.ts +8 -8
- package/src/lint-fix.test.ts +15 -2
- package/src/new-paper.test.ts +2 -2
- package/src/paper-includes.test.ts +62 -1
- package/src/paper-settings-commands.test.ts +1 -1
- package/src/preset-card-rule.test.ts +4 -0
- package/src/presets.test.ts +141 -4
- package/src/presets.ts +120 -22
- package/src/register-bands.ts +13 -23
- package/src/rule-cases.test.ts +155 -16
- package/src/rule-sets.test.ts +150 -0
- package/src/rule-sets.ts +63 -0
- package/src/rules-config.ts +31 -3
- package/src/tex-requirements.ts +4 -0
- package/src/tex-venue-rules.test.ts +45 -1
- package/src/tex-venue-rules.ts +3 -2
- package/src/venue-rules.test.ts +2 -2
|
@@ -85,10 +85,10 @@ describe("paper/folder-venue-leftover — the folder names another venue", () =>
|
|
|
85
85
|
|
|
86
86
|
it("a venue named by an alias says which alias", () => {
|
|
87
87
|
expect(
|
|
88
|
-
lint("
|
|
88
|
+
lint("emnlp-agents", AIDC).map(
|
|
89
89
|
(r) => /names the venue (.*?), and/u.exec(r.message)?.[1],
|
|
90
90
|
),
|
|
91
|
-
).toEqual(["
|
|
91
|
+
).toEqual(["REALM («EMNLP»)"]);
|
|
92
92
|
});
|
|
93
93
|
|
|
94
94
|
it("two other venues are two findings", () => {
|
|
@@ -129,6 +129,17 @@ describe("paper/folder-venue-leftover — the folder names another venue", () =>
|
|
|
129
129
|
});
|
|
130
130
|
});
|
|
131
131
|
|
|
132
|
+
describe("paper/folder-venue-leftover — a workshop's parent conference", () => {
|
|
133
|
+
it("🔴 in another venue's paper it is reported once, as itself", () => {
|
|
134
|
+
const named = (folder: string) =>
|
|
135
|
+
lint(folder, AIDC).map(
|
|
136
|
+
(r) => /names the venue (.*?), and/u.exec(r.message)?.[1],
|
|
137
|
+
);
|
|
138
|
+
expect(named("acm-ccs-agents")).toEqual(["ACM CCS"]);
|
|
139
|
+
expect(named("ase-agents")).toEqual(["ASE"]);
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
|
|
132
143
|
describe("paper/folder-venue-leftover — silent", () => {
|
|
133
144
|
it.each<[string, string, object | undefined]>([
|
|
134
145
|
[
|
|
@@ -137,6 +148,16 @@ describe("paper/folder-venue-leftover — silent", () => {
|
|
|
137
148
|
{ extends: "paperlint:agenticdev", kind: "short" },
|
|
138
149
|
],
|
|
139
150
|
["by its alias", "acsac-2026", AIDC],
|
|
151
|
+
[
|
|
152
|
+
"the conference the workshop is held at (`parent`)",
|
|
153
|
+
"ase-agents",
|
|
154
|
+
{ extends: "paperlint:agenticdev", kind: "short" },
|
|
155
|
+
],
|
|
156
|
+
[
|
|
157
|
+
"the parent conference by its two words",
|
|
158
|
+
"acm-ccs-agents",
|
|
159
|
+
{ extends: "paperlint:aisec", kind: "research" },
|
|
160
|
+
],
|
|
140
161
|
["the folder names no venue", "agent-rule-drift", AIDC],
|
|
141
162
|
// Whole words only: REALM is not inside these.
|
|
142
163
|
["a venue's name inside another word", "overrealm-realms", AIDC],
|
package/src/folder-venue-rule.ts
CHANGED
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
* The folder's name, as the path module gives it (the directory of the linted file), its words
|
|
12
12
|
* against each shipped venue's label and `aliases` (`src/domain/venue-name.ts`). The venues are
|
|
13
13
|
* `otherVenues` — the presets not on this paper's own chain, the same list `tex/venue-leftover`
|
|
14
|
-
* reads — and the paper's own label and aliases
|
|
14
|
+
* reads — and the paper's own label and aliases, and its parent conference's names (`parentNames`),
|
|
15
|
+
* are never reported.
|
|
15
16
|
*
|
|
16
17
|
* ── WHICH FILE IT REPORTS ON ─────────────────────────────────────────────────────
|
|
17
18
|
* The folder itself is not a file ESLint lints. `PIPELINE-STATUS.md` is: every paper folder has one
|
|
@@ -71,15 +72,14 @@ const shown = (n: NamedIn): string =>
|
|
|
71
72
|
*/
|
|
72
73
|
export function judgeFolder(
|
|
73
74
|
folder: string,
|
|
74
|
-
preset: Pick<Preset, "label" | "aliases">,
|
|
75
|
+
preset: Pick<Preset, "label" | "aliases" | "parentNames">,
|
|
75
76
|
others: readonly OtherVenue[],
|
|
76
77
|
): readonly Finding[] {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
);
|
|
78
|
+
const own = [preset.label, ...preset.aliases, ...preset.parentNames];
|
|
79
|
+
return venuesNamedBy(folder, others, own).map((n) => ({
|
|
80
|
+
messageId: "leftover",
|
|
81
|
+
data: { folder, other: shown(n), venue: preset.label },
|
|
82
|
+
}));
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
/**
|
package/src/lint-fix.test.ts
CHANGED
|
@@ -59,9 +59,12 @@ const ruleIds = (stdout: string): string[] =>
|
|
|
59
59
|
r.messages.map((m) => m.ruleId ?? "(fatal)"),
|
|
60
60
|
);
|
|
61
61
|
|
|
62
|
+
/** The writing set on for every paper: the typography rules `--fix` rewrites are in it. */
|
|
63
|
+
const WRITING = { rules: { "paperlint:writing": "warn" } };
|
|
64
|
+
|
|
62
65
|
describe("paperlint lint --fix", () => {
|
|
63
66
|
it("🔴 three `§` and a bare decimal → --fix → zero findings, and the file says Section", async () => {
|
|
64
|
-
const root = project(
|
|
67
|
+
const root = project(WRITING);
|
|
65
68
|
const before = ruleIds((await lint(root)).out);
|
|
66
69
|
expect(before.filter((r) => r === "paper/section-word")).toHaveLength(3);
|
|
67
70
|
expect(before).toContain("paper/leading-zero");
|
|
@@ -74,12 +77,22 @@ describe("paperlint lint --fix", () => {
|
|
|
74
77
|
});
|
|
75
78
|
|
|
76
79
|
it("without --fix nothing is written", async () => {
|
|
77
|
-
const root = project(
|
|
80
|
+
const root = project(WRITING);
|
|
78
81
|
await lint(root);
|
|
79
82
|
expect(readFileSync(join(root, "papers/a/paper.tex"), "utf8")).toMatch(
|
|
80
83
|
/§5/,
|
|
81
84
|
);
|
|
82
85
|
});
|
|
86
|
+
|
|
87
|
+
it("🔴 without the writing set, the same paper gets no typography finding and --fix writes nothing", async () => {
|
|
88
|
+
const root = project({});
|
|
89
|
+
const ids = ruleIds((await lint(root, ["--fix"])).out);
|
|
90
|
+
expect(ids).not.toContain("paper/section-word");
|
|
91
|
+
expect(ids).not.toContain("paper/leading-zero");
|
|
92
|
+
expect(readFileSync(join(root, "papers/a/paper.tex"), "utf8")).toBe(
|
|
93
|
+
PAPER("See §5, §6 and §7; $p < .05$."),
|
|
94
|
+
);
|
|
95
|
+
});
|
|
83
96
|
});
|
|
84
97
|
|
|
85
98
|
describe("sibling cards: `read:` is required, from the package's own schema", () => {
|
package/src/new-paper.test.ts
CHANGED
|
@@ -295,11 +295,11 @@ describe("paperlint new --venue msr", () => {
|
|
|
295
295
|
|
|
296
296
|
describe("paperlint new --venue — a venue it cannot use", () => {
|
|
297
297
|
it("an unknown venue exits 2, lists the shipped presets, and creates nothing", async () => {
|
|
298
|
-
const r = await newIn(["--venue", "
|
|
298
|
+
const r = await newIn(["--venue", "neurips"]);
|
|
299
299
|
expect(r.code).toBe(2);
|
|
300
300
|
// Guards: the list is read from the shipped presets, the same list lint prints.
|
|
301
301
|
expect(r.err).toContain(shippedPresets(presetsDir()).join(", "));
|
|
302
|
-
expect(r.err).toMatch(/--venue
|
|
302
|
+
expect(r.err).toMatch(/--venue neurips: no such venue preset/);
|
|
303
303
|
expect(existsSync(r.dir)).toBe(false);
|
|
304
304
|
});
|
|
305
305
|
});
|
|
@@ -55,6 +55,10 @@ function project(
|
|
|
55
55
|
dirs.push(root);
|
|
56
56
|
const all: Record<string, string> = {
|
|
57
57
|
"package.json": JSON.stringify({ name: "c", private: true }),
|
|
58
|
+
// The typography rules these cases read are opt-in, in the writing set: on for every paper.
|
|
59
|
+
"paperlint.json": JSON.stringify({
|
|
60
|
+
rules: { "paperlint:writing": "warn" },
|
|
61
|
+
}),
|
|
58
62
|
"papers/a/PIPELINE-STATUS.md": "---\nstages: []\n---\n",
|
|
59
63
|
"papers/a/paper.tex": doc(
|
|
60
64
|
"{article}",
|
|
@@ -215,11 +219,68 @@ describe("a built paper whose files are clean", () => {
|
|
|
215
219
|
});
|
|
216
220
|
expect({ code, out }).toEqual({
|
|
217
221
|
code: 0,
|
|
218
|
-
|
|
222
|
+
// The root file that turns the writing set on is named first, as every found config is.
|
|
223
|
+
out: ["config: paperlint.json", "✓ 3 file(s) checked, no findings"],
|
|
219
224
|
});
|
|
220
225
|
});
|
|
221
226
|
});
|
|
222
227
|
|
|
228
|
+
describe("an opt-in rule turned on for a paper's body files only", () => {
|
|
229
|
+
/** `paper/leading-zero` on for `files` alone, in the root file: no writing set. */
|
|
230
|
+
const onlyFor = (files: string[]) => ({
|
|
231
|
+
"paperlint.json": JSON.stringify({
|
|
232
|
+
rules: [{ files, rules: { "paper/leading-zero": "warn" } }],
|
|
233
|
+
}),
|
|
234
|
+
});
|
|
235
|
+
const lintCode = async (root: string, args: string[] = []) => {
|
|
236
|
+
const out: string[] = [];
|
|
237
|
+
const err: string[] = [];
|
|
238
|
+
const code = await run(["lint", "--json", ...args], {
|
|
239
|
+
cwd: root,
|
|
240
|
+
log: (s: string) => out.push(s),
|
|
241
|
+
err: (s: string) => err.push(s),
|
|
242
|
+
});
|
|
243
|
+
return { code, out: out.join("\n"), err: err.join("\n") };
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
it("🔴 reaches the included file it runs on: the run reports there, and is not refused as a rule no paper gets", async () => {
|
|
247
|
+
const r = await lintCode(project(onlyFor(["papers/a/sections/**/*.tex"])));
|
|
248
|
+
expect(r.err).not.toMatch(/no paper\.tex of the project gets it/);
|
|
249
|
+
expect(r.code).toBe(0);
|
|
250
|
+
const intro = lintReport(r.out).find((f) =>
|
|
251
|
+
f.filePath.endsWith("papers/a/sections/intro.tex"),
|
|
252
|
+
);
|
|
253
|
+
expect(intro?.messages.map((m) => m.ruleId)).toEqual([
|
|
254
|
+
"paper/leading-zero",
|
|
255
|
+
]);
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
it("🔴 with --fix too: the fix rewrites the included file, which leaves the build's record behind it, and the run is still not refused", async () => {
|
|
259
|
+
const root = project(onlyFor(["papers/a/sections/**/*.tex"]));
|
|
260
|
+
const r = await lintCode(root, ["--fix"]);
|
|
261
|
+
expect(r.err).not.toMatch(/no paper\.tex of the project gets it/);
|
|
262
|
+
expect(r.code).toBe(0);
|
|
263
|
+
expect(lintReport(r.out).length).toBeGreaterThan(0);
|
|
264
|
+
expect(
|
|
265
|
+
readFileSync(join(root, "papers/a/sections/intro.tex"), "utf8"),
|
|
266
|
+
).toBe(INTRO.replace(".05", "0.05"));
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
it.each([[[]], [["--fix"]]])(
|
|
270
|
+
"a glob that reaches no file of any paper still fails the run (args %j)",
|
|
271
|
+
async (args) => {
|
|
272
|
+
const r = await lintCode(
|
|
273
|
+
project(onlyFor(["papers/a/nothing/**/*.tex"])),
|
|
274
|
+
args,
|
|
275
|
+
);
|
|
276
|
+
expect(r.code).toBe(1);
|
|
277
|
+
expect(r.err).toMatch(
|
|
278
|
+
/^paper\/leading-zero is turned on in "rules", but no paper\.tex of the project gets it/m,
|
|
279
|
+
);
|
|
280
|
+
},
|
|
281
|
+
);
|
|
282
|
+
});
|
|
283
|
+
|
|
223
284
|
describe("a paper whose record is missing, stale or silent about a file", () => {
|
|
224
285
|
it("🔴 a paper no build has recorded is paper.tex alone: its includes are not linted, and paper/sources-fresh says so", async () => {
|
|
225
286
|
const { byFile } = await lint(project({}, null));
|
|
@@ -302,7 +302,7 @@ describe("paperlint lint — the paper over its preset, and the project's own pr
|
|
|
302
302
|
const r = await lint(root);
|
|
303
303
|
expect(r.code).toBe(1);
|
|
304
304
|
expect(r.out).toMatch(
|
|
305
|
-
/acm-sigconf, agent, agenticdev, agentverify, aidc, aisec, ieee-conference, msr, nlbse, realm/,
|
|
305
|
+
/acm-sigconf, agent, agenticdev, agentverify, aidc, aisec, ase, ccs, icse, ieee-conference, msr, nlbse, realm, sp/,
|
|
306
306
|
);
|
|
307
307
|
});
|
|
308
308
|
});
|
|
@@ -92,10 +92,14 @@ describe("the shipped cards", () => {
|
|
|
92
92
|
"agentverify.md",
|
|
93
93
|
"aidc.md",
|
|
94
94
|
"aisec.md",
|
|
95
|
+
"ase.md",
|
|
96
|
+
"ccs.md",
|
|
97
|
+
"icse.md",
|
|
95
98
|
"ieee-conference.md",
|
|
96
99
|
"msr.md",
|
|
97
100
|
"nlbse.md",
|
|
98
101
|
"realm.md",
|
|
102
|
+
"sp.md",
|
|
99
103
|
"tex-base.md",
|
|
100
104
|
]);
|
|
101
105
|
expect(results.flatMap((r) => r.messages)).toEqual([]);
|
package/src/presets.test.ts
CHANGED
|
@@ -202,6 +202,21 @@ const DECLARED = {
|
|
|
202
202
|
name: "AISec",
|
|
203
203
|
url: "https://aisec.cc/",
|
|
204
204
|
},
|
|
205
|
+
"ase.jsonc": {
|
|
206
|
+
type: "venue",
|
|
207
|
+
name: "ASE",
|
|
208
|
+
url: "https://conf.researchr.org/track/ase-2026/ase-2026-research-track",
|
|
209
|
+
},
|
|
210
|
+
"ccs.jsonc": {
|
|
211
|
+
type: "venue",
|
|
212
|
+
name: "ACM CCS",
|
|
213
|
+
url: "https://www.sigsac.org/ccs/CCS2026/call-for/call-for-papers.html",
|
|
214
|
+
},
|
|
215
|
+
"icse.jsonc": {
|
|
216
|
+
type: "venue",
|
|
217
|
+
name: "ICSE 2028",
|
|
218
|
+
url: "https://conf.researchr.org/track/icse-2028/icse-2028-papers",
|
|
219
|
+
},
|
|
205
220
|
"ieee-conference.jsonc": { type: "family" },
|
|
206
221
|
"msr.jsonc": {
|
|
207
222
|
type: "venue",
|
|
@@ -218,6 +233,11 @@ const DECLARED = {
|
|
|
218
233
|
name: "REALM",
|
|
219
234
|
url: "https://realm-workshop.github.io/call_for_papers",
|
|
220
235
|
},
|
|
236
|
+
"sp.jsonc": {
|
|
237
|
+
type: "venue",
|
|
238
|
+
name: "IEEE S&P",
|
|
239
|
+
url: "https://sp2027.ieee-security.org/cfpapers.html",
|
|
240
|
+
},
|
|
221
241
|
"tex-base.jsonc": { type: "base" },
|
|
222
242
|
};
|
|
223
243
|
|
|
@@ -476,7 +496,7 @@ describe("what does not resolve, and says why", () => {
|
|
|
476
496
|
"a shipped name with a typo",
|
|
477
497
|
"paperlint:agenticdve",
|
|
478
498
|
"not-found",
|
|
479
|
-
/acm-sigconf, agent, agenticdev, agentverify, aidc, aisec, ieee-conference, msr, nlbse, realm/,
|
|
499
|
+
/acm-sigconf, agent, agenticdev, agentverify, aidc, aisec, ase, ccs, icse, ieee-conference, msr, nlbse, realm, sp/,
|
|
480
500
|
],
|
|
481
501
|
["the base TeX set", "paperlint:tex-base", "not-found", /agenticdev/],
|
|
482
502
|
[
|
|
@@ -587,6 +607,116 @@ describe("chains that do not resolve: the files themselves", () => {
|
|
|
587
607
|
});
|
|
588
608
|
});
|
|
589
609
|
|
|
610
|
+
describe("a workshop's parent conference (`parent`)", () => {
|
|
611
|
+
it("agenticdev is held at ase and aisec at ccs: the parent's names, not the workshop's aliases", () => {
|
|
612
|
+
const names = (spec: string) => {
|
|
613
|
+
const r = resolve(spec);
|
|
614
|
+
return r.ok ? [r.value.aliases, r.value.parentNames] : r.error;
|
|
615
|
+
};
|
|
616
|
+
expect(names("paperlint:agenticdev")).toEqual([["AgenticDev"], ["ASE"]]);
|
|
617
|
+
expect(names("paperlint:aisec")).toEqual([["AISec"], ["ACM CCS"]]);
|
|
618
|
+
expect(names("paperlint:ccs")).toEqual([["ACM CCS"], []]);
|
|
619
|
+
});
|
|
620
|
+
|
|
621
|
+
it("a parent's own parent counts too, and a child of the workshop inherits its parent", () => {
|
|
622
|
+
const r = resolve("./w.jsonc", {
|
|
623
|
+
"/work/papers/p/w.jsonc": venue({
|
|
624
|
+
extends: "paperlint:acm-sigconf",
|
|
625
|
+
parent: "./c.jsonc",
|
|
626
|
+
}),
|
|
627
|
+
"/work/papers/p/c.jsonc": venue(
|
|
628
|
+
{ extends: "paperlint:acm-sigconf", parent: "paperlint:ccs" },
|
|
629
|
+
"Our Conference",
|
|
630
|
+
),
|
|
631
|
+
});
|
|
632
|
+
expect(r.ok && r.value.parentNames).toEqual(["Our Conference", "ACM CCS"]);
|
|
633
|
+
const mine = resolve("./mine.jsonc", {
|
|
634
|
+
"/work/papers/p/mine.jsonc": venue({ extends: "paperlint:agenticdev" }),
|
|
635
|
+
});
|
|
636
|
+
expect(mine.ok && mine.value.parentNames).toEqual(["ASE"]);
|
|
637
|
+
});
|
|
638
|
+
});
|
|
639
|
+
|
|
640
|
+
/** A parent that cannot be used, the files around it, and the line that refuses it. */
|
|
641
|
+
const BAD_PARENTS: readonly [string, Record<string, string>, string][] = [
|
|
642
|
+
[
|
|
643
|
+
"a parent that names no preset",
|
|
644
|
+
{
|
|
645
|
+
"/work/papers/p/w.jsonc": venue({
|
|
646
|
+
extends: "paperlint:acm-sigconf",
|
|
647
|
+
parent: "paperlint:nope",
|
|
648
|
+
}),
|
|
649
|
+
},
|
|
650
|
+
`the preset /work/papers/p/w.jsonc names a parent conference that does not resolve to a venue: "parent": "paperlint:nope" names no preset (${join(VENUES, "nope.jsonc")}); shipped presets (paperlint:<name>): ${shippedPresets(VENUES).join(", ")}`,
|
|
651
|
+
],
|
|
652
|
+
[
|
|
653
|
+
"a parent that is a template family",
|
|
654
|
+
{
|
|
655
|
+
"/work/papers/p/w.jsonc": venue({
|
|
656
|
+
extends: "paperlint:acm-sigconf",
|
|
657
|
+
parent: "paperlint:acm-sigconf",
|
|
658
|
+
}),
|
|
659
|
+
},
|
|
660
|
+
`the preset /work/papers/p/w.jsonc names a parent conference that does not resolve to a venue: "parent": "paperlint:acm-sigconf" is a family, and a workshop's parent is the venue it is held at`,
|
|
661
|
+
],
|
|
662
|
+
[
|
|
663
|
+
"a parent whose own parent does not resolve: the file that names it",
|
|
664
|
+
{
|
|
665
|
+
"/work/papers/p/w.jsonc": venue({
|
|
666
|
+
extends: "paperlint:acm-sigconf",
|
|
667
|
+
parent: "./c.jsonc",
|
|
668
|
+
}),
|
|
669
|
+
"/work/papers/p/c.jsonc": venue({
|
|
670
|
+
extends: "paperlint:acm-sigconf",
|
|
671
|
+
parent: "./gone.jsonc",
|
|
672
|
+
}),
|
|
673
|
+
},
|
|
674
|
+
`the preset /work/papers/p/c.jsonc names a parent conference that does not resolve to a venue: "parent": "./gone.jsonc" names no preset (/work/papers/p/gone.jsonc); shipped presets (paperlint:<name>): ${shippedPresets(VENUES).join(", ")}`,
|
|
675
|
+
],
|
|
676
|
+
[
|
|
677
|
+
"a parent whose own chain does not resolve",
|
|
678
|
+
{
|
|
679
|
+
"/work/papers/p/w.jsonc": venue({
|
|
680
|
+
extends: "paperlint:acm-sigconf",
|
|
681
|
+
parent: "./c.jsonc",
|
|
682
|
+
}),
|
|
683
|
+
"/work/papers/p/c.jsonc": venue({ extends: "./gone.jsonc" }),
|
|
684
|
+
},
|
|
685
|
+
`the preset /work/papers/p/w.jsonc names a parent conference that does not resolve to a venue: "parent": "./c.jsonc" does not resolve: "extends": "./gone.jsonc" names no preset (/work/papers/p/gone.jsonc); shipped presets (paperlint:<name>): ${shippedPresets(VENUES).join(", ")}`,
|
|
686
|
+
],
|
|
687
|
+
[
|
|
688
|
+
"parents that name each other",
|
|
689
|
+
{
|
|
690
|
+
"/work/papers/p/w.jsonc": venue({
|
|
691
|
+
extends: "paperlint:acm-sigconf",
|
|
692
|
+
parent: "./c.jsonc",
|
|
693
|
+
}),
|
|
694
|
+
"/work/papers/p/c.jsonc": venue({
|
|
695
|
+
extends: "paperlint:acm-sigconf",
|
|
696
|
+
parent: "./w.jsonc",
|
|
697
|
+
}),
|
|
698
|
+
},
|
|
699
|
+
`the presets name each other as "parent" in a cycle: /work/papers/p/w.jsonc → /work/papers/p/c.jsonc → /work/papers/p/w.jsonc`,
|
|
700
|
+
],
|
|
701
|
+
];
|
|
702
|
+
|
|
703
|
+
describe("a workshop's parent conference (`parent`): what is refused", () => {
|
|
704
|
+
it.each(BAD_PARENTS)("🔴 refused: %s", (_, files, text) => {
|
|
705
|
+
const r = resolve("./w.jsonc", files);
|
|
706
|
+
expect(r.ok ? "resolved" : presetProblemText(r.error)).toBe(text);
|
|
707
|
+
});
|
|
708
|
+
|
|
709
|
+
it("the schema refuses a parent on a template family", () => {
|
|
710
|
+
const r = resolve("./fam.jsonc", {
|
|
711
|
+
"/work/papers/p/fam.jsonc": family({
|
|
712
|
+
extends: "paperlint:acm-sigconf",
|
|
713
|
+
parent: "paperlint:ccs",
|
|
714
|
+
}),
|
|
715
|
+
});
|
|
716
|
+
expect(r.ok ? "resolved" : r.error.kind).toBe("broken");
|
|
717
|
+
});
|
|
718
|
+
});
|
|
719
|
+
|
|
590
720
|
describe("a preset's template: kept as its file spells it, with that file", () => {
|
|
591
721
|
it("a child's template replaces its parent's, and names its own file", () => {
|
|
592
722
|
const r = resolve("./own.jsonc", {
|
|
@@ -649,14 +779,17 @@ describe("shippedVenueNames — what each shipped venue is called", () => {
|
|
|
649
779
|
"AGENTVERIFY",
|
|
650
780
|
"AIDC",
|
|
651
781
|
"AISec",
|
|
782
|
+
"ASE",
|
|
783
|
+
"ACM CCS",
|
|
784
|
+
"ICSE 2028",
|
|
652
785
|
"ieee-conference",
|
|
653
786
|
"MSR",
|
|
654
787
|
"NLBSE",
|
|
655
788
|
"REALM",
|
|
789
|
+
"IEEE S&P",
|
|
656
790
|
]);
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
);
|
|
791
|
+
// AISec's parent conference is its `parent`, not an alias: ACM CCS is named by ccs alone.
|
|
792
|
+
expect(names.find((n) => n.label === "AISec")?.aliases).toEqual(["AISec"]);
|
|
660
793
|
});
|
|
661
794
|
|
|
662
795
|
it("a preset that does not resolve is left out", () => {
|
|
@@ -674,9 +807,13 @@ describe("shippedVenueNames — what each shipped venue is called", () => {
|
|
|
674
807
|
"AGENTVERIFY",
|
|
675
808
|
"AIDC",
|
|
676
809
|
"AISec",
|
|
810
|
+
"ASE",
|
|
811
|
+
"ACM CCS",
|
|
812
|
+
"ICSE 2028",
|
|
677
813
|
"ieee-conference",
|
|
678
814
|
"MSR",
|
|
679
815
|
"NLBSE",
|
|
816
|
+
"IEEE S&P",
|
|
680
817
|
]);
|
|
681
818
|
});
|
|
682
819
|
});
|
package/src/presets.ts
CHANGED
|
@@ -28,6 +28,14 @@
|
|
|
28
28
|
* template the child wins, with its `template_forbids`; so does `name`, and `required_sections`, `register`, `talk`,
|
|
29
29
|
* `portal`, `deadlines` and `submission_fields` (each whole)
|
|
30
30
|
* aliases union, with every `name` — what the venue is called along the chain
|
|
31
|
+
* parent the child wins: the conference a workshop is held at, a spec resolved from the
|
|
32
|
+
* file that names it
|
|
33
|
+
*
|
|
34
|
+
* ── THE PARENT CONFERENCE ─────────────────────────────────────────────────────────
|
|
35
|
+
* A workshop names the venue it is held at (`"parent": "paperlint:ccs"` in aisec.jsonc). The parent
|
|
36
|
+
* is resolved like any spec and must be a venue; its names, and its own parent's, are
|
|
37
|
+
* `parentNames`: names a paper of this venue may use as its own. A parent that does not resolve to
|
|
38
|
+
* a venue, or parents that name each other, are refused naming the file that says it.
|
|
31
39
|
*
|
|
32
40
|
* ── THE ID AND THE LABEL ──────────────────────────────────────────────────────────
|
|
33
41
|
* The facts file and the build plan carry the preset's `id`: the spec's file name without its
|
|
@@ -60,6 +68,7 @@ import {
|
|
|
60
68
|
} from "./paper-settings.ts";
|
|
61
69
|
import { CONFIG_FILE } from "#lib/paper-config";
|
|
62
70
|
import { messageOf } from "./domain/text.ts";
|
|
71
|
+
import { setMembers } from "./rule-sets.ts";
|
|
63
72
|
import type { RegisterAnchor } from "./domain/register.ts";
|
|
64
73
|
import type { VenueTalk } from "./domain/talk.ts";
|
|
65
74
|
import type { VenuePortal } from "./domain/submission.ts";
|
|
@@ -106,6 +115,11 @@ export interface Preset {
|
|
|
106
115
|
readonly template: PresetTemplate | null;
|
|
107
116
|
/** Every `name` and `aliases` along the chain: what this venue is called in a paper's text. */
|
|
108
117
|
readonly aliases: readonly string[];
|
|
118
|
+
/**
|
|
119
|
+
* Every name of the conference this venue is held at (`parent`), and of that one's parent: names a
|
|
120
|
+
* paper of this venue may use as its own. Empty when no file of the chain names a parent.
|
|
121
|
+
*/
|
|
122
|
+
readonly parentNames: readonly string[];
|
|
109
123
|
/** Whether the venue reviews double-blind (`anonymity/identity`); false when no file of the chain says. */
|
|
110
124
|
readonly blind: boolean;
|
|
111
125
|
/**
|
|
@@ -153,7 +167,11 @@ export type PresetProblem =
|
|
|
153
167
|
/** A family extending a venue, or anything extending the base set. */
|
|
154
168
|
readonly parentType: "venue" | "base";
|
|
155
169
|
}
|
|
156
|
-
| { readonly kind: "broken"; readonly file: string; readonly why: string }
|
|
170
|
+
| { readonly kind: "broken"; readonly file: string; readonly why: string }
|
|
171
|
+
/** `file` names a parent conference that does not resolve to a venue preset: `why`. */
|
|
172
|
+
| { readonly kind: "bad-parent"; readonly file: string; readonly why: string }
|
|
173
|
+
/** Venues that name each other as `parent`, in the order they were followed. */
|
|
174
|
+
| { readonly kind: "parent-cycle"; readonly chain: readonly string[] };
|
|
157
175
|
|
|
158
176
|
/** The display label of a spec: the file name without its extension. Pure. */
|
|
159
177
|
export function labelOf(spec: string): string {
|
|
@@ -284,12 +302,23 @@ const namesOf = (i: PresetIdentity): readonly string[] =>
|
|
|
284
302
|
i.type === "venue" ? [i.name] : [];
|
|
285
303
|
|
|
286
304
|
/** What the merge carries from file to file: the preset without what only the whole chain knows. */
|
|
287
|
-
type Merging = Omit<
|
|
305
|
+
type Merging = Omit<
|
|
306
|
+
Preset,
|
|
307
|
+
"id" | "label" | "chain" | "identity" | "parentNames"
|
|
308
|
+
> & {
|
|
288
309
|
readonly name: string | null;
|
|
310
|
+
readonly parent: ParentLink | null;
|
|
289
311
|
};
|
|
290
312
|
|
|
313
|
+
/** A `parent` as a file of the chain names it: the spec, and the file it is resolved from. */
|
|
314
|
+
interface ParentLink {
|
|
315
|
+
readonly spec: string;
|
|
316
|
+
readonly file: string;
|
|
317
|
+
}
|
|
318
|
+
|
|
291
319
|
const NOTHING_MERGED: Merging = {
|
|
292
320
|
name: null,
|
|
321
|
+
parent: null,
|
|
293
322
|
template: null,
|
|
294
323
|
aliases: [],
|
|
295
324
|
blind: false,
|
|
@@ -333,6 +362,7 @@ const mergeOne = (
|
|
|
333
362
|
{ preset: p, file }: { readonly preset: PresetFile; readonly file: string },
|
|
334
363
|
): Merging => ({
|
|
335
364
|
name: nameOf(p.identity) ?? acc.name,
|
|
365
|
+
parent: p.parent === null ? acc.parent : { spec: p.parent, file },
|
|
336
366
|
template:
|
|
337
367
|
p.template === null
|
|
338
368
|
? acc.template
|
|
@@ -350,12 +380,12 @@ const mergeOne = (
|
|
|
350
380
|
...wholeBlocks(acc, p),
|
|
351
381
|
});
|
|
352
382
|
|
|
353
|
-
/** The chain, root first, merged into one preset. Pure. */
|
|
383
|
+
/** The chain, root first, merged into one preset, and the parent it names. Pure. */
|
|
354
384
|
function merged(
|
|
355
385
|
spec: string,
|
|
356
386
|
rootFirst: readonly { readonly preset: PresetFile; readonly file: string }[],
|
|
357
387
|
leaf: { readonly preset: PresetFile },
|
|
358
|
-
): Preset {
|
|
388
|
+
): Omit<Preset, "parentNames"> & { readonly parent: ParentLink | null } {
|
|
359
389
|
const { name, ...rest } = rootFirst.reduce(mergeOne, NOTHING_MERGED);
|
|
360
390
|
return {
|
|
361
391
|
id: labelOf(spec),
|
|
@@ -366,6 +396,62 @@ function merged(
|
|
|
366
396
|
};
|
|
367
397
|
}
|
|
368
398
|
|
|
399
|
+
/** A problem as a caller reads it: a missing file lists the shipped presets. */
|
|
400
|
+
const refusal = (p: PresetProblem, venuesDir: string): PresetProblem =>
|
|
401
|
+
p.kind === "not-found" ? { ...p, shipped: shippedPresets(venuesDir) } : p;
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* The names `parent` brings, resolved from the file that names it: the parent venue's names and its
|
|
405
|
+
* own `parentNames`. `below` is every venue whose parent led here, so a cycle is refused. A problem
|
|
406
|
+
* of a parent further up is passed on as it is: it names the file that says the bad parent.
|
|
407
|
+
*/
|
|
408
|
+
function parentNamesOf(
|
|
409
|
+
parent: ParentLink,
|
|
410
|
+
below: readonly string[],
|
|
411
|
+
deps: PresetDeps,
|
|
412
|
+
): Result<readonly string[], PresetProblem> {
|
|
413
|
+
const up = resolveFrom(parent.spec, parent.file, deps, below);
|
|
414
|
+
const bad = (why: string): Result<readonly string[], PresetProblem> =>
|
|
415
|
+
err({ kind: "bad-parent", file: parent.file, why });
|
|
416
|
+
const named = `"parent": "${parent.spec}"`;
|
|
417
|
+
if (!up.ok) {
|
|
418
|
+
const p = up.error;
|
|
419
|
+
if (p.kind === "bad-parent" || p.kind === "parent-cycle") return up;
|
|
420
|
+
// The parent's own file is missing or misspelt: say it of `parent`, not of an `extends`.
|
|
421
|
+
return "spec" in p && p.spec === parent.spec
|
|
422
|
+
? bad(presetProblemText(p, "parent"))
|
|
423
|
+
: bad(`${named} does not resolve: ${presetProblemText(p)}`);
|
|
424
|
+
}
|
|
425
|
+
if (up.value.identity.type !== "venue")
|
|
426
|
+
return bad(
|
|
427
|
+
`${named} is a ${up.value.identity.type}, and a workshop's parent is the venue it is held at`,
|
|
428
|
+
);
|
|
429
|
+
return ok([...new Set([...up.value.aliases, ...up.value.parentNames])]);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/** `resolvePreset`, inside the venues `below` whose `parent` led here. */
|
|
433
|
+
function resolveFrom(
|
|
434
|
+
spec: string,
|
|
435
|
+
fromFile: string,
|
|
436
|
+
deps: PresetDeps,
|
|
437
|
+
below: readonly string[],
|
|
438
|
+
): Result<Preset, PresetProblem> {
|
|
439
|
+
const leaf = readPreset(spec, fromFile, deps);
|
|
440
|
+
if (!leaf.ok) return err(refusal(leaf.error, deps.venuesDir));
|
|
441
|
+
const here = [...below, leaf.value.file];
|
|
442
|
+
if (below.includes(leaf.value.file))
|
|
443
|
+
return err({ kind: "parent-cycle", chain: here });
|
|
444
|
+
const chain = chainUp([leaf.value], leaf.value, deps);
|
|
445
|
+
if (!chain.ok) return err(refusal(chain.error, deps.venuesDir));
|
|
446
|
+
const { parent, ...preset } = merged(
|
|
447
|
+
spec,
|
|
448
|
+
[...chain.value].reverse(),
|
|
449
|
+
leaf.value,
|
|
450
|
+
);
|
|
451
|
+
const names = parent === null ? ok([]) : parentNamesOf(parent, here, deps);
|
|
452
|
+
return names.ok ? ok({ ...preset, parentNames: names.value }) : names;
|
|
453
|
+
}
|
|
454
|
+
|
|
369
455
|
/**
|
|
370
456
|
* `spec`, as written in `fromFile` (a paper's `paperlint.json`), → the merged preset, or why it
|
|
371
457
|
* does not resolve. Reads through `deps.files` only; never throws.
|
|
@@ -375,17 +461,7 @@ export function resolvePreset(
|
|
|
375
461
|
fromFile: string,
|
|
376
462
|
deps: PresetDeps,
|
|
377
463
|
): Result<Preset, PresetProblem> {
|
|
378
|
-
|
|
379
|
-
err(
|
|
380
|
-
p.kind === "not-found"
|
|
381
|
-
? { ...p, shipped: shippedPresets(deps.venuesDir) }
|
|
382
|
-
: p,
|
|
383
|
-
);
|
|
384
|
-
const leaf = readPreset(spec, fromFile, deps);
|
|
385
|
-
if (!leaf.ok) return refused(leaf.error);
|
|
386
|
-
const chain = chainUp([leaf.value], leaf.value, deps);
|
|
387
|
-
if (!chain.ok) return refused(chain.error);
|
|
388
|
-
return ok(merged(spec, [...chain.value].reverse(), leaf.value));
|
|
464
|
+
return resolveFrom(spec, fromFile, deps, []);
|
|
389
465
|
}
|
|
390
466
|
|
|
391
467
|
/** The shipped presets' names (each is spelled `paperlint:<name>`). */
|
|
@@ -433,26 +509,48 @@ export const venueOf = ({
|
|
|
433
509
|
export const shippedVenueNames = (deps: PresetDeps): readonly ShippedVenue[] =>
|
|
434
510
|
resolveShipped(deps).map(venueOf);
|
|
435
511
|
|
|
436
|
-
/**
|
|
437
|
-
|
|
512
|
+
/** For a rule set named where a venue belongs, where the set goes instead; "" otherwise. Pure. */
|
|
513
|
+
const ruleSetHint = (spec: string): string =>
|
|
514
|
+
setMembers(spec) === null
|
|
515
|
+
? ""
|
|
516
|
+
: `. ${spec} is a rule set, not a venue: turn it on in "rules": { "${spec}": "warn" }`;
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* One line for a problem, naming what to change. `key` is the setting that named the spec of an
|
|
520
|
+
* `unsupported` or `not-found` problem. Pure.
|
|
521
|
+
*/
|
|
522
|
+
export function presetProblemText(
|
|
523
|
+
p: PresetProblem,
|
|
524
|
+
key: "extends" | "parent" = "extends",
|
|
525
|
+
): string {
|
|
438
526
|
switch (p.kind) {
|
|
439
527
|
case "unsupported":
|
|
440
|
-
return `"
|
|
528
|
+
return `"${key}": "${p.spec}" — a preset is \`paperlint:<name>\` (shipped) or a path starting with ./ or ../ (your own); npm presets: not yet supported. Did you mean "${shippedSpec(p.spec)}"?`;
|
|
441
529
|
case "not-found":
|
|
442
|
-
return `"
|
|
530
|
+
return `"${key}": "${p.spec}" names no preset (${p.file}); shipped presets (${SHIPPED_PREFIX}<name>): ${p.shipped.join(", ")}${ruleSetHint(p.spec)}`;
|
|
443
531
|
case "cycle":
|
|
444
532
|
return `the presets extend each other in a cycle: ${p.chain.join(" → ")}`;
|
|
445
533
|
case "too-deep":
|
|
446
534
|
return `the preset chain is longer than ${String(MAX_PRESET_DEPTH)}: ${p.chain.join(" → ")}`;
|
|
447
535
|
case "broken":
|
|
448
536
|
return `the preset ${p.file} does not parse: ${p.why}`;
|
|
537
|
+
case "bad-parent":
|
|
538
|
+
return `the preset ${p.file} names a parent conference that does not resolve to a venue: ${p.why}`;
|
|
539
|
+
case "parent-cycle":
|
|
540
|
+
return `the presets name each other as "parent" in a cycle: ${p.chain.join(" → ")}`;
|
|
449
541
|
case "wrong-parent":
|
|
450
|
-
return p
|
|
451
|
-
? `the preset ${p.file} extends ${p.parent}, the TeX base set — every paper gets that set already, and no preset extends it`
|
|
452
|
-
: `the preset ${p.file} is a template family and extends ${p.parent}, a venue — a family builds only on a family; a venue extends a family or another venue`;
|
|
542
|
+
return wrongParentText(p);
|
|
453
543
|
}
|
|
454
544
|
}
|
|
455
545
|
|
|
546
|
+
/** The line for a chain whose file extends a preset of a type it may not extend. Pure. */
|
|
547
|
+
const wrongParentText = (
|
|
548
|
+
p: Extract<PresetProblem, { readonly kind: "wrong-parent" }>,
|
|
549
|
+
): string =>
|
|
550
|
+
p.parentType === "base"
|
|
551
|
+
? `the preset ${p.file} extends ${p.parent}, the TeX base set — every paper gets that set already, and no preset extends it`
|
|
552
|
+
: `the preset ${p.file} is a template family and extends ${p.parent}, a venue — a family builds only on a family; a venue extends a family or another venue`;
|
|
553
|
+
|
|
456
554
|
// ── a paper's preset ────────────────────────────────────────────────────────────────────
|
|
457
555
|
|
|
458
556
|
/** What one paper declares and the preset it resolves to — one answer for every reader. */
|