paperlint 20.1.0 → 20.1.2

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.
Files changed (86) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.github/workflows/ci.yml +7 -0
  3. package/CLAUDE.md +2 -2
  4. package/CONTRIBUTING.md +2 -2
  5. package/{action.harness.mjs → action.test.mjs} +147 -138
  6. package/dist/domain/paper-layout.d.ts +18 -6
  7. package/dist/domain/paper-layout.d.ts.map +1 -1
  8. package/dist/domain/paper-layout.js +44 -38
  9. package/dist/domain/paper-layout.js.map +1 -1
  10. package/dist/eslint-rules/papers.js +1 -1
  11. package/dist/folder-layout-hook.js +1 -1
  12. package/dist/latex-log.d.ts +1 -1
  13. package/dist/latex-log.js +1 -1
  14. package/dist/latex-loop.d.ts +1 -1
  15. package/dist/latex-loop.js +1 -1
  16. package/dist/lib/paper-config.d.ts +3 -3
  17. package/dist/lib/paper-config.js +3 -3
  18. package/docs/e2e.md +9 -9
  19. package/docs/install.md +11 -11
  20. package/docs/rules/paper/allowed-files-only.md +31 -28
  21. package/docs/testing.md +3 -4
  22. package/eslint-rules/{install-path-literals.harness.mjs → install-path-literals.test.mjs} +14 -13
  23. package/eslint-rules/{latex-language.harness.mjs → latex-language-rules.test.mjs} +61 -51
  24. package/eslint-rules/{paper-stages.harness.mjs → paper-stages-rule.test.mjs} +66 -69
  25. package/eslint-rules/{papers.harness.mjs → papers.test.mjs} +41 -30
  26. package/eslint-rules/papers.ts +1 -1
  27. package/eslint-rules/{pdf-last-page-balance.harness.mjs → pdf-last-page-balance.test.mjs} +27 -15
  28. package/eslint-rules/{temp-root-realpath.harness.mjs → temp-root-realpath.test.mjs} +24 -24
  29. package/eslint-rules/{tex-build.harness.mjs → tex-build.test.mjs} +292 -271
  30. package/eslint.config.mjs +15 -2
  31. package/fixtures/pdf-facts/README.md +1 -1
  32. package/fixtures/render-paper/build-clean.sh +1 -1
  33. package/fixtures/toolchain-mirror/install-tl +1 -1
  34. package/lib/{agent-cli-version.harness.mjs → agent-cli-version.test.mjs} +17 -18
  35. package/lib/{paper-config.harness.mjs → paper-config.test.mjs} +21 -20
  36. package/lib/paper-config.ts +3 -3
  37. package/lib/{skill-trigger-cases.harness.mjs → skill-trigger-cases-carrier.test.mjs} +78 -115
  38. package/package.json +3 -3
  39. package/presets/acm-acmsmall.jsonc +1 -1
  40. package/scripts/check-workflow.test.ts +368 -0
  41. package/scripts/check.ts +2 -2
  42. package/scripts/eslint-file-length.mjs +9 -9
  43. package/scripts/eslint-report-guard.mjs +1 -1
  44. package/scripts/eslint-report-guard.test.mjs +1 -1
  45. package/scripts/harness-api.test.ts +7 -46
  46. package/scripts/{rules-see-files.harness.mjs → rules-see-files-rule.test.mjs} +10 -6
  47. package/scripts/rules-see-files.mjs +1 -1
  48. package/skills/paper-pipeline/{paper-pipeline.harness.mjs → paper-pipeline.test.mjs} +45 -46
  49. package/skills/paper-pipeline/scripts/{consumer.harness.mjs → consumer-paths.test.mjs} +66 -59
  50. package/skills/paper-pipeline/scripts/consumer.mjs +3 -3
  51. package/skills/paper-pipeline/scripts/{extract-ref-facts.harness.mjs → extract-ref-facts-cli.test.mjs} +29 -31
  52. package/skills/paper-pipeline/scripts/fixtures/real-bib/refs.bib +1 -1
  53. package/skills/paper-pipeline/scripts/{generated-code.harness.mjs → generated-code-fixtures.test.mjs} +39 -46
  54. package/skills/render-paper/{extract-pdf-facts.harness.ts → extract-pdf-facts.test.ts} +20 -13
  55. package/skills/render-paper/{render-paper.harness.mjs → render-paper.test.mjs} +41 -40
  56. package/src/adapters/pdfjs/fill.test.ts +1 -1
  57. package/src/{build-engine.harness.mjs → build-engine-prepare.test.mjs} +98 -81
  58. package/src/{build.harness.mjs → build-fake-tex.test.mjs} +61 -28
  59. package/src/{cli.harness.mjs → cli-e2e.test.mjs} +109 -103
  60. package/src/cli.test.ts +2 -2
  61. package/src/{doctor.harness.mjs → doctor-install.test.mjs} +28 -29
  62. package/src/domain/paper-layout.test.ts +89 -49
  63. package/src/domain/paper-layout.ts +61 -42
  64. package/src/{engine.harness.mjs → engine.test.mjs} +120 -106
  65. package/src/facts-file.test.ts +1 -1
  66. package/src/folder-layout-hook.test.ts +1 -1
  67. package/src/folder-layout-hook.ts +1 -1
  68. package/src/folder-layout-rule.test.ts +1 -1
  69. package/src/{hooks-settings.harness.ts → hooks-settings.test.ts} +161 -146
  70. package/src/latex-log.test.ts +395 -0
  71. package/src/latex-log.ts +1 -1
  72. package/src/latex-loop.test.ts +553 -0
  73. package/src/latex-loop.ts +1 -1
  74. package/src/layout-docs.test.ts +47 -0
  75. package/src/{link-skills.harness.ts → link-skills-fs.test.ts} +26 -26
  76. package/src/{new-paper.harness.mjs → new-paper-scaffold.test.mjs} +31 -19
  77. package/src/{pdf-facts.harness.ts → pdf-facts-tables.test.ts} +28 -22
  78. package/src/{pdf-geometry.harness.ts → pdf-geometry.test.ts} +93 -75
  79. package/src/{rules-config.harness.ts → rules-config.test.ts} +41 -31
  80. package/src/{structure.harness.ts → structure.test.ts} +12 -10
  81. package/src/{tex-requirements.harness.ts → tex-requirements-tables.test.ts} +106 -85
  82. package/src/{toolchain.harness.mjs → toolchain-mirror.test.mjs} +204 -186
  83. package/scripts/check.harness.ts +0 -343
  84. package/scripts/harness-api.frozen.json +0 -41
  85. package/src/latex-log.harness.ts +0 -382
  86. package/src/latex-loop.harness.ts +0 -515
@@ -1,21 +1,27 @@
1
1
  /**
2
2
  * `rules-config.ts` — parsing the `rules` key into ESLint config blocks, and deriving which rules
3
- * paperlint ships. The end-to-end path (a project's paperlint.json → `paperlint lint`) is in `cli.harness.mjs`;
3
+ * paperlint ships. The end-to-end path (a project's paperlint.json → `paperlint lint`) is in `cli-e2e.test.mjs`;
4
4
  * this pins the parser's output shape and each refusal.
5
5
  */
6
- import { createChecker } from "../lib/check.ts";
6
+ import { failureMessage } from "../lib/check.ts";
7
+ import { expect, it } from "vitest";
7
8
 
8
9
  const { parseRuleBlocks, shippedRuleIds, unknownKeys } =
9
10
  await import("./rules-config.ts");
10
11
 
11
- const check = createChecker();
12
+ // A failed check is recorded and the rest of the test keeps running.
13
+ const check = (label: string, cond: unknown, detail?: unknown): void => {
14
+ expect.soft(cond, failureMessage(label, detail)).toBeTruthy();
15
+ };
12
16
 
13
17
  const SHIPPED = new Set(["pdf/last-page-balance", "paper/typography"]);
14
18
  const parse = (raw: unknown) => parseRuleBlocks(raw, "S", SHIPPED, "/consumer");
15
19
 
16
- const none = parse(undefined);
17
- check("no `rules` key: no blocks", none.ok && none.value.length === 0);
18
- {
20
+ it("no `rules` key: no blocks", () => {
21
+ const none = parse(undefined);
22
+ check("no `rules` key: no blocks", none.ok && none.value.length === 0);
23
+ });
24
+ it("a block keeps files, ignores and rules, with basePath", () => {
19
25
  const r = parse([
20
26
  {
21
27
  files: ["papers/a/**"],
@@ -35,8 +41,8 @@ check("no `rules` key: no blocks", none.ok && none.value.length === 0);
35
41
  }),
36
42
  JSON.stringify(r),
37
43
  );
38
- }
39
- {
44
+ });
45
+ it("the object form is one block with no `files`", () => {
40
46
  const r = parse({ "pdf/last-page-balance": "error" });
41
47
  check(
42
48
  "the object form is ONE block with no `files` — narrowed to each rule's own files later",
@@ -50,12 +56,15 @@ check("no `rules` key: no blocks", none.ok && none.value.length === 0);
50
56
  ]),
51
57
  JSON.stringify(r),
52
58
  );
53
- }
54
- check(
55
- "both severity spellings are accepted",
56
- parse([{ rules: { "paper/typography": 0, "pdf/last-page-balance": "warn" } }])
57
- .ok,
58
- );
59
+ });
60
+ it("both severity spellings are accepted", () => {
61
+ check(
62
+ "both severity spellings are accepted",
63
+ parse([
64
+ { rules: { "paper/typography": 0, "pdf/last-page-balance": "warn" } },
65
+ ]).ok,
66
+ );
67
+ });
59
68
  const refusals: [unknown, string][] = [
60
69
  ["pdf/last-page-balance", 'S → "rules" must be { "<rule>": "<severity>" }'],
61
70
  [{ a: 1 }, '"a" is not a rule paperlint ships'],
@@ -79,20 +88,25 @@ const refusals: [unknown, string][] = [
79
88
  'S → rules[0].rules["paper/typography"]: ["loud"] is not a severity',
80
89
  ],
81
90
  ];
82
- for (const [raw, says] of refusals) {
83
- const r = parse(raw);
91
+ it("every refusal names its key", () => {
92
+ for (const [raw, says] of refusals) {
93
+ const r = parse(raw);
94
+ check(
95
+ `refused, naming the key: ${says}`,
96
+ !r.ok && r.error.includes(says),
97
+ JSON.stringify(r),
98
+ );
99
+ }
100
+ });
101
+ it("unknown top-level keys are found by name", () => {
84
102
  check(
85
- `refused, naming the key: ${says}`,
86
- !r.ok && r.error.includes(says),
87
- JSON.stringify(r),
103
+ "unknown top-level keys are found by name; the known ones are not",
104
+ JSON.stringify(
105
+ unknownKeys({ papersDir: "p", rules: [], papersDri: "x" }),
106
+ ) === JSON.stringify(["papersDri"]),
88
107
  );
89
- }
90
- check(
91
- "unknown top-level keys are found by name; the known ones are not",
92
- JSON.stringify(unknownKeys({ papersDir: "p", rules: [], papersDri: "x" })) ===
93
- JSON.stringify(["papersDri"]),
94
- );
95
- {
108
+ });
109
+ it("shipped rule ids are read off the config's own plugins", () => {
96
110
  const foreign = { rules: { "no-html": {} } };
97
111
  const ids = shippedRuleIds(
98
112
  [
@@ -119,8 +133,4 @@ check(
119
133
  JSON.stringify(["paper/typography", "pdf/last-page-balance"]),
120
134
  JSON.stringify([...ids]),
121
135
  );
122
- }
123
-
124
- console.log(
125
- `✓ ${String(check.count)} assertions passed — rules-config: blocks parsed with basePath, every refusal names its key`,
126
- );
136
+ });
@@ -6,6 +6,8 @@
6
6
  * So every "found" here has a paired "not found on the neighboring directory", and the defaults
7
7
  * are separately checked against the shape of the live corpus.
8
8
  */
9
+ import { afterAll, expect, it } from "vitest";
10
+ import { failureMessage } from "../lib/check.ts";
9
11
  import {
10
12
  mkdtempSync,
11
13
  mkdirSync,
@@ -16,7 +18,6 @@ import {
16
18
  import { tmpdir } from "node:os";
17
19
  import { join, dirname } from "node:path";
18
20
  import { z } from "zod";
19
- import { createChecker } from "../lib/check.ts";
20
21
 
21
22
  /** `asEslintResults` promises only `unknown[]`; these are the fields the checks read. */
22
23
  const EslintResults = z.array(
@@ -31,7 +32,10 @@ const EslintResults = z.array(
31
32
  const { checkStructure, formatStructure, asEslintResults, STRUCTURE_DEFAULTS } =
32
33
  await import("./structure.ts");
33
34
 
34
- const check = createChecker();
35
+ // A failed check is recorded and the rest of the test keeps running.
36
+ const check = (label: string, cond: unknown, detail?: unknown): void => {
37
+ expect.soft(cond, failureMessage(label, detail)).toBeTruthy();
38
+ };
35
39
 
36
40
  const root = realpathSync(mkdtempSync(join(tmpdir(), "paperlint-struct-")));
37
41
  const papers = join(root, "papers");
@@ -45,7 +49,11 @@ const paper = (name: string, files: readonly string[]) => {
45
49
  return dir;
46
50
  };
47
51
 
48
- try {
52
+ afterAll(() => {
53
+ rmSync(root, { recursive: true, force: true });
54
+ });
55
+
56
+ it("structure: a missing file cannot complain for itself", () => {
49
57
  paper("complete", ["PIPELINE-STATUS.md", "paper.tex", "refs.bib"]);
50
58
  // the marker is present (paper.tex), the scorecard is not — the directory is linted by ZERO
51
59
  // rules and reports clean
@@ -171,10 +179,4 @@ try {
171
179
  "and the path is RELATIVE — an absolute path to the temp directory tells the reader nothing",
172
180
  f.every((x) => !x.file.startsWith("/")),
173
181
  );
174
- } finally {
175
- rmSync(root, { recursive: true, force: true });
176
- }
177
-
178
- console.log(
179
- `✓ ${String(check.count)} assertions passed — structure: a missing file cannot complain for itself`,
180
- );
182
+ });
@@ -17,14 +17,23 @@ import {
17
17
  } from "node:fs";
18
18
  import { tmpdir } from "node:os";
19
19
  import { join } from "node:path";
20
- import { createChecker } from "../lib/check.ts";
20
+ import { afterAll, beforeAll, expect, it, vi } from "vitest";
21
+
22
+ // Several tests here run real ESLint, spawn processes or walk the repository.
23
+ vi.setConfig({ testTimeout: 120_000 });
21
24
 
22
25
  const R = await import("./tex-requirements.ts");
23
26
  const { parseTemplate, parseTemplateStyle } =
24
27
  await import("./adapters/latex/index.ts");
25
28
  const VENUES = (await import("./package-dirs.ts")).presetsDir();
26
29
 
27
- const check = createChecker();
30
+ /** One soft assertion: a failed check does not stop the checks after it in the same test. */
31
+ const check = (label: string, cond: unknown, detail?: unknown): void => {
32
+ const shown = typeof detail === "string" ? detail : JSON.stringify(detail);
33
+ expect
34
+ .soft(cond, detail === undefined ? label : `${label}\n${shown}`)
35
+ .toBe(true);
36
+ };
28
37
  const throws = (fn: () => unknown): string => {
29
38
  try {
30
39
  fn();
@@ -39,27 +48,31 @@ const read = (f: string) =>
39
48
  // ── 1. the shipped data ─────────────────────────────────────────────────────────────────
40
49
  const venues = R.venueNames(VENUES);
41
50
  // Guards: keeping tex-base out of the venue list — it would be offered as a venue named tex-base.
42
- check(
43
- "venueNames: the .jsonc profiles, without the base set",
44
- venues.length >= 3 && !venues.includes("tex-base"),
45
- venues.join(","),
46
- );
47
- for (const v of venues)
51
+ it("1. the shipped data: venueNames: the .jsonc profiles, without the base set", () => {
48
52
  check(
49
- `${v}.jsonc passes the schema`,
50
- throws(() => read(`${v}.jsonc`)) === "",
51
- throws(() => read(`${v}.jsonc`)),
53
+ "venueNames: the .jsonc profiles, without the base set",
54
+ venues.length >= 3 && !venues.includes("tex-base"),
55
+ venues.join(","),
52
56
  );
57
+ for (const v of venues)
58
+ check(
59
+ `${v}.jsonc passes the schema`,
60
+ throws(() => read(`${v}.jsonc`)) === "",
61
+ throws(() => read(`${v}.jsonc`)),
62
+ );
63
+ });
53
64
  const base = read("tex-base.jsonc");
54
- check(
55
- "tex-base: the programs the skills run (texcount, checkcites) are declared as TOOLS",
56
- base.tools.texcount?.[0] === "texcount" &&
57
- base.tools.checkcites?.[0] === "checkcites",
58
- );
59
- check(
60
- "tex-base: cm-super — without it pdflatex silently rasterizes to Type 3",
61
- "cm-super" in base.packages,
62
- );
65
+ it("1. the shipped data: tex-base: the programs the skills run (texcount, checkcites) are declared as TOOLS", () => {
66
+ check(
67
+ "tex-base: the programs the skills run (texcount, checkcites) are declared as TOOLS",
68
+ base.tools.texcount?.[0] === "texcount" &&
69
+ base.tools.checkcites?.[0] === "checkcites",
70
+ );
71
+ check(
72
+ "tex-base: cm-super — without it pdflatex silently rasterizes to Type 3",
73
+ "cm-super" in base.packages,
74
+ );
75
+ });
63
76
 
64
77
  // The class each profile's template names, as the parser reads it — never a line of text.
65
78
  const presetOf = (v: string) =>
@@ -71,29 +84,31 @@ const presetOf = (v: string) =>
71
84
  const templateOf = (v: string): string | undefined =>
72
85
  parseTemplate(presetOf(v).template ?? "")?.cls;
73
86
  const acm = venues.filter((v) => templateOf(v) === "acmart");
74
- check(
75
- "at least one acmart venue is shipped (else the next checks see nothing)",
76
- acm.length > 0,
77
- );
78
- for (const v of acm) {
79
- const tex = read(`${v}.jsonc`);
80
- // acmart.cls checks ALL THREE font packages and falls back to Computer Modern SILENTLY when any
81
- // is missing; newtx needs binhex.tex (kastrup) or the build stops hard; fancyhdr (#37).
82
- for (const [pkg, file] of [
83
- ["libertine", "libertine.sty"],
84
- ["inconsolata", "zi4.sty"],
85
- ["newtx", "newtxmath.sty"],
86
- ["kastrup", "binhex.tex"],
87
- // Guards: #37 — fancyhdr was held up by an accident of the base image and is absent on a
88
- // minimal one.
89
- ["fancyhdr", "fancyhdr.sty"],
90
- ["acmart", "acmart.cls"],
91
- ] satisfies [string, string][])
92
- check(
93
- `🔴 ${v}: declares ${pkg}, proved by ${file}`,
94
- tex.packages[pkg]?.includes(file),
95
- );
96
- }
87
+ it("1. the shipped data: at least one acmart venue is shipped (else the next checks see nothing)", () => {
88
+ check(
89
+ "at least one acmart venue is shipped (else the next checks see nothing)",
90
+ acm.length > 0,
91
+ );
92
+ for (const v of acm) {
93
+ const tex = read(`${v}.jsonc`);
94
+ // acmart.cls checks ALL THREE font packages and falls back to Computer Modern SILENTLY when any
95
+ // is missing; newtx needs binhex.tex (kastrup) or the build stops hard; fancyhdr (#37).
96
+ for (const [pkg, file] of [
97
+ ["libertine", "libertine.sty"],
98
+ ["inconsolata", "zi4.sty"],
99
+ ["newtx", "newtxmath.sty"],
100
+ ["kastrup", "binhex.tex"],
101
+ // Guards: #37 — fancyhdr was held up by an accident of the base image and is absent on a
102
+ // minimal one.
103
+ ["fancyhdr", "fancyhdr.sty"],
104
+ ["acmart", "acmart.cls"],
105
+ ] satisfies [string, string][])
106
+ check(
107
+ `🔴 ${v}: declares ${pkg}, proved by ${file}`,
108
+ tex.packages[pkg]?.includes(file),
109
+ );
110
+ }
111
+ });
97
112
  // Venues on ONE template must not drift apart: a second list is how the old installer's three
98
113
  // dictionaries diverged. Since the ACM venues extend the `acm-sigconf` family, only the family
99
114
  // declares the template's packages, so this holds by construction; the check stays for any two
@@ -110,21 +125,23 @@ for (const v of venues.filter((x) => presetOf(x).extends === null)) {
110
125
  }
111
126
  // Guards: the key tells a style family from a bare class — else every article-based style would be
112
127
  // held to REALM's list.
113
- check(
114
- "neurips-style and acl-latex are two templates: article + neurips_2026, article + no style",
115
- templateKey("neurips-style") === "article + neurips_2026" &&
116
- templateKey("acl-latex") === "article + no style",
117
- `${templateKey("neurips-style")} · ${templateKey("acl-latex")}`,
118
- );
119
- for (const [t, vs] of byTemplate)
128
+ it("1. the shipped data: neurips-style and acl-latex are two templates: article + neurips_2026, article + no style", () => {
120
129
  check(
121
- `venues on template ${String(t)} declare the SAME packages (${vs.join(", ")})`,
122
- new Set(vs.map((v) => JSON.stringify(read(`${v}.jsonc`)))).size === 1,
130
+ "neurips-style and acl-latex are two templates: article + neurips_2026, article + no style",
131
+ templateKey("neurips-style") === "article + neurips_2026" &&
132
+ templateKey("acl-latex") === "article + no style",
133
+ `${templateKey("neurips-style")} · ${templateKey("acl-latex")}`,
123
134
  );
135
+ for (const [t, vs] of byTemplate)
136
+ check(
137
+ `venues on template ${String(t)} declare the SAME packages (${vs.join(", ")})`,
138
+ new Set(vs.map((v) => JSON.stringify(read(`${v}.jsonc`)))).size === 1,
139
+ );
140
+ });
124
141
 
125
142
  // A venues directory whose schema file is JSON but not a schema: refused where it is read, with
126
143
  // the file's name — not deep inside Ajv as "schema should be object or boolean".
127
- {
144
+ it("1. the shipped data: a schema file that is not a JSON object is refused, naming the file", () => {
128
145
  const odd = realpathSync(
129
146
  mkdtempSync(join(tmpdir(), "paperlint-texreq-schema-")),
130
147
  );
@@ -136,11 +153,13 @@ for (const [t, vs] of byTemplate)
136
153
  ).test(throws(() => R.parsePreset("{}", "odd.jsonc", odd))),
137
154
  throws(() => R.parsePreset("{}", "odd.jsonc", odd)),
138
155
  );
139
- }
156
+ });
140
157
 
141
158
  // ── 2. the schema rejects ───────────────────────────────────────────────────────────────
142
159
  const tmp = realpathSync(mkdtempSync(join(tmpdir(), "paperlint-texreq-h-")));
143
- copyFileSync(join(VENUES, R.SCHEMA_FILE), join(tmp, R.SCHEMA_FILE));
160
+ beforeAll(() => {
161
+ copyFileSync(join(VENUES, R.SCHEMA_FILE), join(tmp, R.SCHEMA_FILE));
162
+ });
144
163
  const bad = (text: string) =>
145
164
  throws(() => R.parseProfile(text, "bad.jsonc", tmp));
146
165
  const BAD: [string, string, string][] = [
@@ -181,29 +200,33 @@ const BAD: [string, string, string][] = [
181
200
  "additional properties",
182
201
  ],
183
202
  ];
184
- for (const [label, text, says] of BAD) {
185
- const msg = bad(text);
203
+ it("2. the schema rejects", () => {
204
+ for (const [label, text, says] of BAD) {
205
+ const msg = bad(text);
206
+ check(
207
+ `schema rejects ${label}, and says where`,
208
+ msg.includes("does not match") && msg.includes(says),
209
+ msg,
210
+ );
211
+ }
186
212
  check(
187
- `schema rejects ${label}, and says where`,
188
- msg.includes("does not match") && msg.includes(says),
189
- msg,
213
+ "not JSONC at all: named as such, not as a schema failure",
214
+ bad(`{ "tex": `).includes("not valid JSONC"),
215
+ bad(`{ "tex": `),
190
216
  );
191
- }
192
- check(
193
- "not JSONC at all: named as such, not as a schema failure",
194
- bad(`{ "tex": `).includes("not valid JSONC"),
195
- bad(`{ "tex": `),
196
- );
197
- check(
198
- "comments and trailing commas ARE JSONC",
199
- bad(
200
- `// quote\n{ "type": "family", "tex": { "packages": { "a": ["a.sty"], }, }, }`,
201
- ) === "",
202
- );
203
- rmSync(tmp, { recursive: true, force: true });
217
+ check(
218
+ "comments and trailing commas ARE JSONC",
219
+ bad(
220
+ `// quote\n{ "type": "family", "tex": { "packages": { "a": ["a.sty"], }, }, }`,
221
+ ) === "",
222
+ );
223
+ });
224
+ afterAll(() => {
225
+ rmSync(tmp, { recursive: true, force: true });
226
+ });
204
227
 
205
228
  // ── 3. what a paper gets ────────────────────────────────────────────────────────────────
206
- {
229
+ it("3. what a paper gets: no venue preset → the base set, and the source says so", () => {
207
230
  const r = R.requirementsFor(null, VENUES);
208
231
  // Guards: saying WHY a paper runs on the base set.
209
232
  check(
@@ -213,10 +236,10 @@ rmSync(tmp, { recursive: true, force: true });
213
236
  !("acmart" in r.tex.packages),
214
237
  r.source,
215
238
  );
216
- }
239
+ });
217
240
  // Which preset a paper resolves to — a typo, the base file, a missing one — is src/presets.ts's
218
241
  // question now, tested in src/presets.test.ts; this function only adds a resolved preset's packages.
219
- {
242
+ it("3. what a paper gets: a resolved preset → its packages ON TOP OF the base set, and the source names its label", () => {
220
243
  // `acm` is non-empty: the check above it throws otherwise.
221
244
  const [label = ""] = acm;
222
245
  const r = R.requirementsFor({ label, tex: read(`${label}.jsonc`) }, VENUES);
@@ -228,8 +251,8 @@ rmSync(tmp, { recursive: true, force: true });
228
251
  "texcount" in r.tex.tools,
229
252
  r.source,
230
253
  );
231
- }
232
- {
254
+ });
255
+ it("3. what a paper gets: mergeRequirements: a package declared twice keeps every proof of both", () => {
233
256
  const m = R.mergeRequirements(
234
257
  { packages: { a: ["a.sty"] }, tools: {} },
235
258
  { packages: { a: ["a2.sty"], b: ["b.sty"] }, tools: { t: ["t"] } },
@@ -241,8 +264,8 @@ rmSync(tmp, { recursive: true, force: true });
241
264
  '{"packages":{"a":["a.sty","a2.sty"],"b":["b.sty"]},"tools":{"t":["t"]}}',
242
265
  JSON.stringify(m),
243
266
  );
244
- }
245
- {
267
+ });
268
+ it("3. what a paper gets: declaredUnion: base + every venue — what `paperlint toolchain` installs", () => {
246
269
  const u = R.declaredUnion(VENUES);
247
270
  const names = R.packageNames(u.tex);
248
271
  check(
@@ -258,10 +281,10 @@ rmSync(tmp, { recursive: true, force: true });
258
281
  "packageNames: sorted, unique",
259
282
  names.join() === [...new Set(names)].sort().join(),
260
283
  );
261
- }
284
+ });
262
285
 
263
286
  // ── 5. the parser's tolerances: an optional block left out, and Ajv's optional fields ───
264
- {
287
+ it("5. the parser's tolerances: an optional block left out, and Ajv's optional field: a preset that only extends another: no tex block, `rules` an empty object", () => {
265
288
  const bare = R.parsePreset(
266
289
  '{ "type": "venue", "name": "X", "url": "https://x.org/", "extends": "paperlint:aisec-2026" }',
267
290
  "bare.jsonc",
@@ -300,6 +323,4 @@ rmSync(tmp, { recursive: true, force: true });
300
323
  ],
301
324
  })[0] === "f.jsonc: (top level) ",
302
325
  );
303
- }
304
-
305
- console.log(`tex-requirements: ${String(check.count)} checks passed`);
326
+ });