paperlint 20.6.1 → 20.7.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.
Files changed (70) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/dist/default-levels.d.ts +5 -0
  3. package/dist/default-levels.d.ts.map +1 -0
  4. package/dist/default-levels.js +36 -0
  5. package/dist/default-levels.js.map +1 -0
  6. package/dist/domain/preset-submission-fields.d.ts +15 -0
  7. package/dist/domain/preset-submission-fields.d.ts.map +1 -0
  8. package/dist/domain/preset-submission-fields.js +25 -0
  9. package/dist/domain/preset-submission-fields.js.map +1 -0
  10. package/dist/domain/venue-scope.d.ts +29 -0
  11. package/dist/domain/venue-scope.d.ts.map +1 -0
  12. package/dist/domain/venue-scope.js +18 -0
  13. package/dist/domain/venue-scope.js.map +1 -0
  14. package/dist/folder-venue-rule.d.ts +1 -1
  15. package/dist/folder-venue-rule.d.ts.map +1 -1
  16. package/dist/folder-venue-rule.js.map +1 -1
  17. package/dist/preset-merge.d.ts +34 -0
  18. package/dist/preset-merge.d.ts.map +1 -0
  19. package/dist/preset-merge.js +89 -0
  20. package/dist/preset-merge.js.map +1 -0
  21. package/dist/presets.d.ts +3 -2
  22. package/dist/presets.d.ts.map +1 -1
  23. package/dist/presets.js +3 -84
  24. package/dist/presets.js.map +1 -1
  25. package/dist/tex-requirements.d.ts +4 -1
  26. package/dist/tex-requirements.d.ts.map +1 -1
  27. package/dist/tex-requirements.js +3 -20
  28. package/dist/tex-requirements.js.map +1 -1
  29. package/dist/tex-venue-rules.d.ts +4 -24
  30. package/dist/tex-venue-rules.d.ts.map +1 -1
  31. package/dist/tex-venue-rules.js +6 -84
  32. package/dist/tex-venue-rules.js.map +1 -1
  33. package/dist/venue-leftover.d.ts +50 -0
  34. package/dist/venue-leftover.d.ts.map +1 -0
  35. package/dist/venue-leftover.js +129 -0
  36. package/dist/venue-leftover.js.map +1 -0
  37. package/docs/rules/tex/venue-leftover.md +34 -3
  38. package/docs/rules.md +1 -1
  39. package/docs/venues.md +6 -4
  40. package/package.json +2 -1
  41. package/presets/acl-latex.md +1 -1
  42. package/presets/langcode-2027.jsonc +106 -0
  43. package/presets/langcode-2027.md +79 -0
  44. package/presets/naacl-2027.jsonc +19 -0
  45. package/presets/naacl-2027.md +42 -0
  46. package/presets/venue-profile.schema.json +22 -1
  47. package/scripts/eslint-file-length.mjs +5 -5
  48. package/scripts/release-config.test.ts +114 -0
  49. package/scripts/release-type.test.ts +86 -0
  50. package/scripts/release-type.ts +76 -0
  51. package/scripts/semantic-release-plugins.d.ts +20 -1
  52. package/src/default-levels.test.ts +43 -0
  53. package/src/default-levels.ts +53 -0
  54. package/src/domain/preset-submission-fields.ts +49 -0
  55. package/src/domain/venue-scope.test.ts +33 -0
  56. package/src/domain/venue-scope.ts +39 -0
  57. package/src/folder-venue-rule.ts +2 -1
  58. package/src/paper-settings-commands.test.ts +1 -1
  59. package/src/preset-card-rule.test.ts +2 -0
  60. package/src/preset-merge.ts +141 -0
  61. package/src/presets-scope.test.ts +177 -0
  62. package/src/presets.test.ts +17 -56
  63. package/src/presets.ts +5 -130
  64. package/src/rule-cases.test.ts +10 -3
  65. package/src/tex-requirements.ts +14 -45
  66. package/src/tex-venue-rules.test.ts +66 -154
  67. package/src/tex-venue-rules.ts +25 -146
  68. package/src/venue-leftover.test.ts +112 -0
  69. package/src/venue-leftover.ts +207 -0
  70. package/src/venue-rules.test.ts +2 -2
@@ -3,119 +3,31 @@
3
3
  * memory beside the SHIPPED presets, so a preset edit that breaks a check shows here. Each rule has
4
4
  * both halves: the finding a planted defect produces, and the silence of a conforming source.
5
5
  */
6
- import { readdirSync, readFileSync } from "node:fs";
7
- import { join } from "node:path";
8
6
  import { describe, expect, it } from "vitest";
9
7
  import { memoryFiles } from "./adapters/memory/index.ts";
10
- import { sourcesCodec } from "./adapters/sources-record/index.ts";
11
- import { presetsDir } from "./package-dirs.ts";
12
8
  import { latexReader } from "./adapters/latex/index.ts";
13
9
  import {
14
- cyclePortRules,
15
10
  judgeRequiredSections,
16
- judgeLeftover,
17
11
  judgeStyle,
18
12
  judgeTemplate,
19
13
  otherStyles,
20
14
  otherVenues,
21
15
  FORMAT_RULE_LEVELS,
22
- formatRules,
23
16
  TEX_VENUE_RULE_LEVELS,
24
- texVenueRules,
25
17
  } from "./tex-venue-rules.ts";
26
18
  import { resolvePreset } from "./presets.ts";
27
19
  import { buildConfig, SHIPPED_RULES } from "./cli.ts";
28
20
  import { builtPaper } from "../test/recorded-fixture.ts";
29
21
  import { venuePreset } from "../test/support.ts";
30
-
31
- const VENUES = presetsDir();
32
- const PAPER = "/work/papers/p";
33
- /** What the rules read with besides the files: the presets, the LaTeX reader, the record's schema. */
34
- const READERS = { venuesDir: VENUES, latex: latexReader, codec: sourcesCodec };
35
- const shipped = Object.fromEntries(
36
- readdirSync(VENUES)
37
- .filter((f) => f.endsWith(".jsonc") || f.endsWith(".json"))
38
- .map((f) => [join(VENUES, f), readFileSync(join(VENUES, f))]),
39
- );
40
-
41
- interface Finding {
42
- readonly rule: string;
43
- readonly messageId: string;
44
- readonly message: string;
45
- readonly line: number;
46
- }
47
-
48
- /** The line and 1-based column of an offset, as ESLint's text source code gives them. */
49
- const locOf = (src: string) => (i: number) => {
50
- const before = src.slice(0, i).split("\n");
51
- return { line: before.length, column: (before.at(-1) ?? "").length + 1 };
52
- };
53
-
54
- /**
55
- * Every venue-conformance rule over one `paper.tex`, the way ESLint runs them: `create`, then
56
- * `root`. `settings` is the paper's paperlint.json (absent: no file); `extra` more files.
57
- */
58
- function lint(
59
- tex: string,
60
- settings: object | undefined,
61
- {
62
- filename = `${PAPER}/paper.tex`,
63
- extra = {},
64
- raw = true,
65
- }: {
66
- filename?: string;
67
- extra?: Record<string, string>;
68
- /** false: the source code carries no `raw` (not the `.tex` language's), only `text`. */
69
- raw?: boolean;
70
- } = {},
71
- ): Finding[] {
72
- const files = memoryFiles({
73
- ...shipped,
74
- ...(settings === undefined
75
- ? {}
76
- : { [`${PAPER}/paperlint.json`]: JSON.stringify(settings) }),
77
- ...extra,
78
- });
79
- const out: Finding[] = [];
80
- const deps = { files, ...READERS };
81
- for (const [id, rule] of [
82
- ...Object.entries(texVenueRules(deps)).map(
83
- ([n, r]) => [`tex/${n}`, r] as const,
84
- ),
85
- ...Object.entries(formatRules(deps)).map(
86
- ([n, r]) => [`format/${n}`, r] as const,
87
- ),
88
- ...Object.entries(cyclePortRules(deps)).map(
89
- ([n, r]) => [`cycle/${n}`, r] as const,
90
- ),
91
- ]) {
92
- const visitor = rule.create({
93
- filename,
94
- sourceCode: {
95
- text: tex,
96
- ...(raw ? { raw: tex } : {}),
97
- getLocFromIndex: locOf(tex),
98
- },
99
- report: (d) =>
100
- out.push({
101
- rule: id,
102
- // A finding from an included file arrives as a whole message, its file at the front.
103
- messageId: "messageId" in d ? d.messageId : "(message)",
104
- message:
105
- "messageId" in d
106
- ? Object.entries(d.data ?? {}).reduce(
107
- (m, [k, v]) => m.replaceAll(`{{${k}}}`, String(v)),
108
- rule.meta.messages[d.messageId] ??
109
- `(no message ${d.messageId})`,
110
- )
111
- : d.message,
112
- line: d.loc.start.line,
113
- }),
114
- });
115
- visitor.root?.();
116
- }
117
- return out;
118
- }
22
+ import { shippedVenuesExcept } from "../test/shipped-venues.ts";
23
+ import {
24
+ lint,
25
+ PAPER,
26
+ READERS,
27
+ shipped,
28
+ VENUES,
29
+ type Finding,
30
+ } from "../test/venue-rules-lint.ts";
119
31
 
120
32
  const ids = (fs: readonly Finding[]) =>
121
33
  fs.map((f) => `${f.rule}:${f.messageId}`).sort();
@@ -1127,6 +1039,55 @@ describe("tex/venue-leftover — another venue named in the text", () => {
1127
1039
  });
1128
1040
  });
1129
1041
 
1042
+ describe("tex/venue-leftover — where a leftover is looked for (#552)", () => {
1043
+ const ACM = { extends: "paperlint:acm-sigconf", kind: "research" };
1044
+ const ASE_LINE =
1045
+ "\\acmConference[ASE '26]{Proceedings of the 41st IEEE/ACM International Conference on Automated Software Engineering}{October 12--16, 2026}{Munich, Germany}";
1046
+ const CITED =
1047
+ "\\section{Introduction}\nLam~et~al.\\ (\\emph{CodeCrash}, NeurIPS 2025) report a drop.\n\\section{Conclusion}\nText.\n";
1048
+
1049
+ it("a family preset names no venue, so nothing is another venue: silent", () => {
1050
+ // Guards: an ASE paper on the generic ACM template was told its own \\acmConference is a leftover.
1051
+ const tex = paper(
1052
+ "\\documentclass[sigconf]{acmart}",
1053
+ `${ASE_LINE}\n${BODY}`,
1054
+ );
1055
+ expect(leftovers(lint(tex, ACM))).toEqual([]);
1056
+ });
1057
+
1058
+ it("a venue named in the body after the first section is related work by default: silent", () => {
1059
+ // Guards: a CCS paper citing «(CodeCrash, NeurIPS 2025)» was told it is a leftover.
1060
+ expect(leftovers(lint(aidcPaper(`${CITED}${STATEMENT}`), AIDC))).toEqual(
1061
+ [],
1062
+ );
1063
+ });
1064
+
1065
+ it("with `body: true` the body is read too, and the same citation is reported", () => {
1066
+ const fs = leftovers(
1067
+ lint(aidcPaper(`${CITED}${STATEMENT}`), AIDC, {
1068
+ options: [{ body: true }],
1069
+ }),
1070
+ );
1071
+ expect(fs.map((f) => f.line)).toEqual([5]);
1072
+ });
1073
+
1074
+ it("the front matter is read whatever the option: the author block's leftover is still reported", () => {
1075
+ // Guards: narrowing the prose scan must not lose the leftover a reviewer reads before the abstract.
1076
+ expect(
1077
+ leftovers(
1078
+ lint(aidcPaper(`${INSTITUTION}\n${BODY}${STATEMENT}`), AIDC),
1079
+ ).map((f) => f.line),
1080
+ ).toEqual([4, 4]);
1081
+ });
1082
+
1083
+ it("a venue command after the first section still counts: it states the paper's venue", () => {
1084
+ const tex = aidcPaper(
1085
+ `${BODY}\\acmConference[AISec '26]{AISec}{2026}{Salt Lake City}\n${STATEMENT}`,
1086
+ );
1087
+ expect(leftovers(lint(tex, AIDC)).length).toBeGreaterThan(0);
1088
+ });
1089
+ });
1090
+
1130
1091
  describe("tex/venue-leftover — a workshop's parent conference (`parent`) is the paper's own", () => {
1131
1092
  const agenticdev = (text: string) =>
1132
1093
  paper("\\documentclass[sigconf]{acmart}", `${text}\nText.`);
@@ -1388,43 +1349,17 @@ describe("tex/venue-leftover — where names are found, and whose they are", ()
1388
1349
  ).toEqual([]);
1389
1350
  });
1390
1351
 
1391
- it("under a family, a venue that extends it is another venue", () => {
1392
- // ieee-conference is on aidc's chain, so under the family aidc is ANOTHER venue.
1352
+ it("under a family, no venue is another venue: the family names none, so it is silent", () => {
1353
+ // Guards: «Accepted at AAAI 2026» on the generic AAAI template, and an ASE paper's own
1354
+ // \\acmConference on the generic ACM one, were reported as leftovers (#552). A family cannot
1355
+ // know which venue the paper is for, so it has nothing to compare a name with.
1393
1356
  const tex = paper(
1394
1357
  "\\documentclass[conference]{IEEEtran}",
1395
1358
  "Accepted at AIDC 2026. Formerly at AISec 2026.",
1396
1359
  );
1397
1360
  expect(
1398
- leftovers(lint(tex, { extends: "paperlint:ieee-conference" }))
1399
- .map((f) => /«(.*?)»/u.exec(f.message)?.[1])
1400
- .sort(),
1401
- ).toEqual(["AIDC", "AISec"]);
1402
- });
1403
- });
1404
-
1405
- describe("tex/venue-leftover, judged on places the parser did not give", () => {
1406
- const files = memoryFiles(shipped);
1407
- const aidc = resolvePreset("paperlint:aidc-2026", `${PAPER}/paperlint.json`, {
1408
- files,
1409
- venuesDir: VENUES,
1410
- });
1411
- const preset = aidc.ok ? aidc.value : null;
1412
-
1413
- it("a venue line with no place holds no name; a parent's name no shipped venue carries is shown as written", () => {
1414
- expect(preset).not.toBeNull();
1415
- if (preset === null) return;
1416
- const src = "Unlike AISec, and Gone 2025.";
1417
- const runs = latexReader.renderedRuns(src);
1418
- // The line is unplaced, so «AISec» without a year stands in prose: silent.
1419
- const found = judgeLeftover(
1420
- runs,
1421
- [{ kind: "unplaced" }],
1422
- { ...preset, parentNames: ["Gone"] },
1423
- [],
1424
- );
1425
- expect(found.map((f) => f.data)).toEqual([
1426
- { name: "Gone", other: "Gone 2025", venue: "AIDC 2026" },
1427
- ]);
1361
+ leftovers(lint(tex, { extends: "paperlint:ieee-conference" })),
1362
+ ).toEqual([]);
1428
1363
  });
1429
1364
  });
1430
1365
 
@@ -1499,32 +1434,9 @@ describe("otherVenues", () => {
1499
1434
  const aidc = resolvePreset("paperlint:aidc-2026", from, deps);
1500
1435
  expect(aidc.ok).toBe(true);
1501
1436
  if (!aidc.ok) return;
1437
+ // aidc's own chain (AIDC over ieee-conference) and REALM, which does not resolve here, are left out.
1502
1438
  expect(otherVenues(aidc.value, deps).map((o) => [o.label, o.year])).toEqual(
1503
- [
1504
- ["AAAI", 2027],
1505
- ["aaai-press", null],
1506
- ["acl-latex", null],
1507
- ["acm-acmsmall", null],
1508
- ["acm-sigconf", null],
1509
- ["ACSAC", 2026],
1510
- ["AGENT", 2027],
1511
- ["AgenticDev", 2026],
1512
- ["AGENTVERIFY", 2027],
1513
- ["AISec", 2026],
1514
- ["ASE", 2026],
1515
- ["ACM CCS", 2026],
1516
- ["EMNLP", 2026],
1517
- ["FSE", 2027],
1518
- ["ICML", 2027],
1519
- ["icml-style", null],
1520
- ["ICSE", 2027],
1521
- ["ICSE", 2028],
1522
- ["MSR", 2027],
1523
- ["NeurIPS", 2026],
1524
- ["neurips-style", null],
1525
- ["NLBSE", 2027],
1526
- ["IEEE S&P", 2027],
1527
- ],
1439
+ shippedVenuesExcept("AIDC", "ieee-conference", "REALM"),
1528
1440
  );
1529
1441
  });
1530
1442
  });
@@ -36,8 +36,6 @@ import {
36
36
  missingOptions,
37
37
  optionsInEffect,
38
38
  readWhole,
39
- runText,
40
- spanIn,
41
39
  usepackageLine,
42
40
  type ClassCandidate,
43
41
  type ClassLine,
@@ -49,7 +47,6 @@ import {
49
47
  type Place,
50
48
  type StylePackage,
51
49
  type Span,
52
- type TextRun,
53
50
  } from "./domain/tex-document.ts";
54
51
  import type { LatexReader } from "./ports/latex.ts";
55
52
  import {
@@ -59,13 +56,17 @@ import {
59
56
  type Preset,
60
57
  type PresetTemplate,
61
58
  } from "./presets.ts";
62
- import type { NamedVenue } from "./domain/venue-name.ts";
63
- import { editionLabel } from "./domain/edition.ts";
64
59
  import type { PaperSource } from "./domain/paper-source.ts";
65
60
  import { readPaper, reportInPaper, type ProseDeps } from "./tex-paper.ts";
66
61
  import type { RequiredSection } from "./tex-requirements.ts";
67
62
  import type { Finding, VenueRuleDeps } from "./venue-rules.ts";
68
63
  import { isPorting } from "./domain/cycle.ts";
64
+ import {
65
+ judgeLeftover,
66
+ LEFTOVER_SCHEMA,
67
+ leftoverPlaces,
68
+ type OtherVenue,
69
+ } from "./venue-leftover.ts";
69
70
 
70
71
  /** A finding and where it points; null points at the top of the file. */
71
72
  export interface Located extends Finding {
@@ -458,143 +459,6 @@ export function judgeRequiredSections(
458
459
  );
459
460
  }
460
461
 
461
- /**
462
- * Another shipped venue as the text names it: the word for it (its `name`), every name it goes by,
463
- * and its edition's year (from its id).
464
- */
465
- export type OtherVenue = NamedVenue & Pick<Preset, "year" | "declaredAliases">;
466
-
467
- /**
468
- * A year beside a name, right after it: `2027`, `'27` or `’27`, after spaces or none (`~` renders
469
- * as a no-break space). Anchored: it is tried on the text after the name.
470
- */
471
- const YEAR_AFTER = /^[\s\u00a0]*(?:(\d{4})|['’](\d{2}))(?![\p{L}\p{N}])/u;
472
-
473
- /** The year written right after offset `end` of `text`, or null. `'27` is 2027. Pure. */
474
- function yearAfter(text: string, end: number): number | null {
475
- const m = YEAR_AFTER.exec(text.slice(end));
476
- if (m === null) return null;
477
- return m[1] !== undefined
478
- ? Number.parseInt(m[1], 10)
479
- : 2000 + Number.parseInt(String(m[2]), 10);
480
- }
481
-
482
- /** `s` as a pattern that matches it literally. */
483
- const literal = (s: string): string =>
484
- s.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
485
-
486
- /** One name a match is judged by: whether it is the paper's own, and the venue it shows as. */
487
- interface NameToJudge {
488
- readonly name: string;
489
- readonly own: boolean;
490
- readonly shows: string;
491
- }
492
-
493
- /**
494
- * Every name to look for, once each: every other shipped venue's, shown as that venue's `name`, and
495
- * the paper's own and its parent's, which count only in another edition. Pure.
496
- */
497
- function namesToJudge(
498
- preset: Pick<Preset, "label" | "aliases" | "parentNames">,
499
- others: readonly OtherVenue[],
500
- ): readonly NameToJudge[] {
501
- const own = new Set([...preset.aliases, ...preset.parentNames]);
502
- const shownBy = (name: string): string =>
503
- others.find((o) => o.aliases.includes(name))?.label ??
504
- (preset.aliases.includes(name) ? preset.label : name);
505
- const all = [...new Set([...others.flatMap((o) => o.aliases), ...own])];
506
- return all.map((name) => ({
507
- name,
508
- own: own.has(name),
509
- shows: shownBy(name),
510
- }));
511
- }
512
-
513
- /**
514
- * Whether a name at a place, with `year` beside it (null: none), names another venue than the
515
- * paper's edition (of year `paperYear`). Inside a venue-identity command (`inLine`) any other
516
- * venue's name counts; in prose only beside a year no older than the paper's year minus one, so
517
- * related work («ICSE 2019») and a bare acronym are not leftovers. The paper's own names, and its
518
- * parent's, count only beside another year: another edition of its own series. Pure.
519
- */
520
- export function namesAnotherEdition(
521
- n: { readonly own: boolean; readonly inLine: boolean },
522
- year: number | null,
523
- paperYear: number | null,
524
- ): boolean {
525
- const recent = paperYear === null || (year !== null && year >= paperYear - 1);
526
- if (n.own)
527
- return (
528
- year !== null &&
529
- paperYear !== null &&
530
- year !== paperYear &&
531
- (n.inLine || recent)
532
- );
533
- return n.inLine || (year !== null && recent);
534
- }
535
-
536
- /** A name to look for, with the pattern that finds it as a whole word. */
537
- type NameMatcher = NameToJudge & { readonly re: RegExp };
538
-
539
- /**
540
- * The findings of one name in one run: each whole-word match judged with the year beside it and
541
- * whether it stands in a venue-stating command (`inLine`). Pure.
542
- */
543
- function matchesIn(
544
- run: TextRun,
545
- n: NameMatcher,
546
- paper: {
547
- readonly inLine: (at: Span | null) => boolean;
548
- readonly year: number | null;
549
- readonly venue: string;
550
- },
551
- ): readonly Located[] {
552
- const { inLine, venue } = paper;
553
- const text = runText(run);
554
- return [...text.matchAll(n.re)].flatMap((m) => {
555
- const at = spanIn(run, m.index, m.index + m[0].length);
556
- const year = yearAfter(text, m.index + m[0].length);
557
- const judged = { own: n.own, inLine: inLine(at) };
558
- if (!namesAnotherEdition(judged, year, paper.year)) return [];
559
- const other = editionLabel(n.shows, year);
560
- return [{ messageId: "leftover", data: { name: m[0], other, venue }, at }];
561
- });
562
- }
563
-
564
- /**
565
- * Each place the rendered text names another venue than the paper's edition — a name as a whole
566
- * word, case and all, judged with the year beside it (`namesAnotherEdition`). `lines` are the spans
567
- * of the commands that state the paper's venue (`\acmConference` …).
568
- */
569
- export function judgeLeftover(
570
- runs: readonly TextRun[],
571
- lines: readonly Place[],
572
- preset: Preset,
573
- others: readonly OtherVenue[],
574
- ): readonly Located[] {
575
- const venue = editionLabel(preset.label, preset.year);
576
- const inLine = (at: Span | null): boolean =>
577
- at !== null &&
578
- lines.some(
579
- (l) =>
580
- l.kind === "at" && l.span.start <= at.start && at.start < l.span.end,
581
- );
582
- const names: readonly NameMatcher[] = namesToJudge(preset, others).map(
583
- (n) => ({
584
- ...n,
585
- re: new RegExp(
586
- `(?<![\\p{L}\\p{N}])${literal(n.name)}(?![\\p{L}\\p{N}])`,
587
- "gu",
588
- ),
589
- }),
590
- );
591
- return runs.flatMap((run) =>
592
- names.flatMap((n) =>
593
- matchesIn(run, n, { inLine, year: preset.year, venue }),
594
- ),
595
- );
596
- }
597
-
598
462
  /** Where a rule's page lives: `docs/rules/tex/<name>.md` on the default branch. */
599
463
  export const ruleDocsUrl = (
600
464
  name:
@@ -618,6 +482,8 @@ export const ruleDocsUrl = (
618
482
  /** What a judge reads: the paper's source through the reader, its preset, the other venues. */
619
483
  interface Reading {
620
484
  readonly src: string;
485
+ /** The rule's options from the config, as ESLint validated them against the rule's schema. */
486
+ readonly options: readonly unknown[];
621
487
  readonly latex: LatexReader;
622
488
  readonly preset: Preset;
623
489
  readonly others: () => readonly OtherVenue[];
@@ -731,9 +597,13 @@ const RULES: Readonly<
731
597
  judge: (r) =>
732
598
  judgeLeftover(
733
599
  r.latex.renderedRuns(r.src),
734
- r.latex.venueLines(r.src),
735
600
  r.preset,
736
601
  r.others(),
602
+ leftoverPlaces(
603
+ r.latex.venueLines(r.src),
604
+ r.latex.outline(r.src),
605
+ r.options,
606
+ ),
737
607
  ),
738
608
  meta: {
739
609
  type: "suggestion",
@@ -742,7 +612,7 @@ const RULES: Readonly<
742
612
  "the text names another shipped venue than the one the paper extends — a leftover from an earlier submission",
743
613
  url: ruleDocsUrl("venue-leftover"),
744
614
  },
745
- schema: [],
615
+ schema: LEFTOVER_SCHEMA,
746
616
  messages: {
747
617
  leftover:
748
618
  "«{{name}}» names {{other}}, and this paper extends {{venue}} — a leftover from an earlier submission? A reviewer reads it before the abstract. Comments and citation keys are not reported; a sentence that names the other venue on purpose can keep it with a disable directive",
@@ -814,7 +684,10 @@ function readingOf(
814
684
  filename: string,
815
685
  src: string,
816
686
  deps: TexVenueRuleDeps,
817
- ): { readonly reading: Reading; readonly paper: PaperSource } | null {
687
+ ): {
688
+ readonly reading: Omit<Reading, "options">;
689
+ readonly paper: PaperSource;
690
+ } | null {
818
691
  const dir = dirname(filename);
819
692
  const p = paperPreset(dir, deps);
820
693
  if (p.kind !== "resolved") return null;
@@ -843,8 +716,14 @@ function rule(name: RuleName, deps: TexVenueRuleDeps): TexRuleModule {
843
716
  root() {
844
717
  const sc = context.sourceCode;
845
718
  const r = readingOf(context.filename, sc.raw ?? sc.text, deps);
719
+ const options = context.options ?? [];
846
720
  if (r !== null)
847
- reportInPaper(context, meta.messages, r.paper, judge(r.reading));
721
+ reportInPaper(
722
+ context,
723
+ meta.messages,
724
+ r.paper,
725
+ judge({ ...r.reading, options }),
726
+ );
848
727
  },
849
728
  };
850
729
  },
@@ -0,0 +1,112 @@
1
+ /**
2
+ * `tex/venue-leftover`'s judge (`src/venue-leftover.ts`): where it reads — the venue lines wherever
3
+ * they stand, the front matter always, the body only with `body` — and a name the parser gave no
4
+ * place. The rule as ESLint runs it, on whole papers, is in `src/tex-venue-rules.test.ts`.
5
+ */
6
+ import { describe, expect, it } from "vitest";
7
+ import { latexReader } from "./adapters/latex/index.ts";
8
+ import { memoryFiles } from "./adapters/memory/index.ts";
9
+ import type { Outline } from "./domain/tex-document.ts";
10
+ import { resolvePreset } from "./presets.ts";
11
+ import {
12
+ frontMatterEnd,
13
+ judgeLeftover,
14
+ leftoverPlaces,
15
+ } from "./venue-leftover.ts";
16
+ import { PAPER, shipped, VENUES } from "../test/venue-rules-lint.ts";
17
+
18
+ /** An outline whose first section starts at `at` (null: no section; "unplaced": one with no place). */
19
+ const outline = (at: number | null | "unplaced"): Outline => ({
20
+ sections:
21
+ at === null
22
+ ? []
23
+ : [
24
+ {
25
+ title: "Introduction",
26
+ place:
27
+ at === "unplaced"
28
+ ? { kind: "unplaced" }
29
+ : { kind: "at", span: { start: at, end: at + 21 } },
30
+ },
31
+ ],
32
+ backMatter: null,
33
+ end: null,
34
+ });
35
+ const span = (start: number) => ({ start, end: start + 5 });
36
+
37
+ describe("frontMatterEnd", () => {
38
+ it("is where the first section starts, or null without a placed one", () => {
39
+ expect(
40
+ [outline(100), outline(null), outline("unplaced")].map(frontMatterEnd),
41
+ ).toEqual([100, null, null]);
42
+ });
43
+ });
44
+
45
+ describe("leftoverPlaces — which prose is read", () => {
46
+ it("by default the front matter only: before the first section, not after it, not unplaced", () => {
47
+ const { read } = leftoverPlaces([], outline(100), []);
48
+ expect([read(span(10)), read(span(150)), read(null)]).toEqual([
49
+ true,
50
+ false,
51
+ false,
52
+ ]);
53
+ });
54
+
55
+ it("with `body: true`, everything, a name with no place included", () => {
56
+ const { read } = leftoverPlaces([], outline(100), [{ body: true }]);
57
+ expect([read(span(10)), read(span(150)), read(null)]).toEqual([
58
+ true,
59
+ true,
60
+ true,
61
+ ]);
62
+ });
63
+
64
+ it("a paper with no section is all front matter", () => {
65
+ const { read } = leftoverPlaces([], outline(null), [{ body: false }]);
66
+ expect([read(span(10)), read(null)]).toEqual([true, true]);
67
+ });
68
+
69
+ it("a venue line holds a name wherever it stands; an unplaced line holds none", () => {
70
+ const { inLine } = leftoverPlaces(
71
+ [{ kind: "at", span: { start: 200, end: 260 } }, { kind: "unplaced" }],
72
+ outline(100),
73
+ [],
74
+ );
75
+ expect([inLine(span(210)), inLine(span(10)), inLine(null)]).toEqual([
76
+ true,
77
+ false,
78
+ false,
79
+ ]);
80
+ });
81
+
82
+ it("an option the schema does not declare is refused, not ignored", () => {
83
+ expect(() =>
84
+ leftoverPlaces([], outline(null), [{ bodies: true }]),
85
+ ).toThrow();
86
+ });
87
+ });
88
+
89
+ describe("judgeLeftover, on places the parser did not give", () => {
90
+ const files = memoryFiles(shipped);
91
+ const aidc = resolvePreset("paperlint:aidc-2026", `${PAPER}/paperlint.json`, {
92
+ files,
93
+ venuesDir: VENUES,
94
+ });
95
+ const preset = aidc.ok ? aidc.value : null;
96
+
97
+ it("a venue line with no place holds no name; a parent's name no shipped venue carries is shown as written", () => {
98
+ expect(preset).not.toBeNull();
99
+ if (preset === null) return;
100
+ const src = "Unlike AISec, and Gone 2025.";
101
+ // The line is unplaced, so «AISec» without a year stands in prose: silent.
102
+ const found = judgeLeftover(
103
+ latexReader.renderedRuns(src),
104
+ { ...preset, parentNames: ["Gone"] },
105
+ [],
106
+ leftoverPlaces([{ kind: "unplaced" }], latexReader.outline(src), []),
107
+ );
108
+ expect(found.map((f) => f.data)).toEqual([
109
+ { name: "Gone", other: "Gone 2025", venue: "AIDC 2026" },
110
+ ]);
111
+ });
112
+ });