paperlint 17.1.0 → 17.3.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 (66) hide show
  1. package/CLAUDE.md +2 -2
  2. package/README.md +24 -20
  3. package/dist/cli.d.ts +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +28 -29
  6. package/dist/cli.js.map +1 -1
  7. package/dist/presets.d.ts.map +1 -1
  8. package/dist/presets.js +6 -1
  9. package/dist/presets.js.map +1 -1
  10. package/dist/register-bands.d.ts +1 -7
  11. package/dist/register-bands.d.ts.map +1 -1
  12. package/dist/register-bands.js +12 -19
  13. package/dist/register-bands.js.map +1 -1
  14. package/dist/rule-sets.d.ts +43 -0
  15. package/dist/rule-sets.d.ts.map +1 -0
  16. package/dist/rule-sets.js +59 -0
  17. package/dist/rule-sets.js.map +1 -0
  18. package/dist/rules-config.d.ts +2 -1
  19. package/dist/rules-config.d.ts.map +1 -1
  20. package/dist/rules-config.js +17 -3
  21. package/dist/rules-config.js.map +1 -1
  22. package/docs/configuration.md +9 -2
  23. package/docs/optional-rules.md +48 -6
  24. package/docs/rules/tex/claim-emphasis.md +1 -1
  25. package/docs/rules/tex/claim-provenance.md +3 -3
  26. package/docs/rules/tex/contrast-frames.md +1 -1
  27. package/docs/rules/tex/max-caption-words.md +1 -1
  28. package/docs/rules/tex/max-paragraph-numbers.md +1 -1
  29. package/docs/rules/tex/max-paragraph-words.md +1 -1
  30. package/docs/rules/tex/max-sentence-words.md +1 -1
  31. package/docs/rules/tex/negated-sentences.md +1 -1
  32. package/docs/rules/tex/register.md +1 -1
  33. package/docs/rules/tex/relation-markers.md +1 -1
  34. package/docs/rules.md +20 -16
  35. package/fixtures/build-e2e/fse/PIPELINE-STATUS.md +3 -0
  36. package/fixtures/build-e2e/fse/expect.json +15 -0
  37. package/fixtures/build-e2e/fse/paper.tex +42 -0
  38. package/fixtures/build-e2e/fse/paperlint.json +1 -0
  39. package/fixtures/build-e2e/fse-over/PIPELINE-STATUS.md +3 -0
  40. package/fixtures/build-e2e/fse-over/expect.json +16 -0
  41. package/fixtures/build-e2e/fse-over/paper.tex +41 -0
  42. package/fixtures/build-e2e/fse-over/paperlint.json +1 -0
  43. package/fixtures/real-papers.test.ts +3 -0
  44. package/package.json +1 -1
  45. package/presets/acm-acmsmall.jsonc +115 -0
  46. package/presets/acm-acmsmall.md +62 -0
  47. package/presets/aidc.jsonc +2 -1
  48. package/presets/aidc.md +4 -3
  49. package/presets/fse.jsonc +93 -0
  50. package/presets/fse.md +143 -0
  51. package/src/cli.harness.mjs +25 -5
  52. package/src/cli.ts +43 -30
  53. package/src/folder-venue-rule.test.ts +11 -0
  54. package/src/lint-fix.test.ts +15 -2
  55. package/src/paper-includes.test.ts +62 -1
  56. package/src/paper-settings-commands.test.ts +1 -1
  57. package/src/preset-card-rule.test.ts +2 -0
  58. package/src/presets.test.ts +52 -1
  59. package/src/presets.ts +8 -1
  60. package/src/register-bands.ts +13 -23
  61. package/src/rule-cases.test.ts +155 -16
  62. package/src/rule-sets.test.ts +150 -0
  63. package/src/rule-sets.ts +63 -0
  64. package/src/rules-config.ts +31 -3
  65. package/src/tex-venue-rules.test.ts +53 -0
  66. package/src/venue-rules.test.ts +132 -2
@@ -26,6 +26,7 @@
26
26
  * config (`buildConfig`), not listed a second time.
27
27
  */
28
28
  import { SETTINGS_KEYS } from "#lib/paper-config";
29
+ import { RULE_SETS, setMembers } from "./rule-sets.ts";
29
30
 
30
31
  /** ESLint's severities, in both of its spellings. */
31
32
  export type Severity = "off" | "warn" | "error" | 0 | 1 | 2;
@@ -97,9 +98,31 @@ function parseEntry(v: unknown): RuleEntry | null {
97
98
  return Array.isArray(v) ? [sev, ...options] : sev;
98
99
  }
99
100
 
101
+ /** A written entry once sets are expanded: a rule's, or a set given more than a severity. */
102
+ type Expanded =
103
+ | { readonly kind: "rule"; readonly id: string; readonly raw: unknown }
104
+ | {
105
+ readonly kind: "set-options";
106
+ readonly set: string;
107
+ readonly raw: unknown;
108
+ };
109
+
110
+ /** One written entry → the entries it stands for: a set's members at its severity, or itself. */
111
+ const expandEntry = ([id, raw]: readonly [
112
+ string,
113
+ unknown,
114
+ ]): readonly Expanded[] => {
115
+ const members = setMembers(id);
116
+ if (members === null) return [{ kind: "rule", id, raw }];
117
+ return isSeverity(raw)
118
+ ? members.map((m): Expanded => ({ kind: "rule", id: m, raw }))
119
+ : [{ kind: "set-options", set: id, raw }];
120
+ };
121
+
100
122
  /**
101
123
  * A `rules` object — rule id → severity or `[severity, ...options]` — with only the rules paperlint
102
- * ships. Read from every `paperlint.json`, the root's and each paper's.
124
+ * ships. Read from every `paperlint.json`, the root's and each paper's. A rule set's name
125
+ * (src/rule-sets.ts) stands for its members at its severity, in its place: a later entry wins.
103
126
  *
104
127
  * @param where the key path to name in messages, e.g. `package.json → "paperlint".rules[0].rules`
105
128
  */
@@ -111,10 +134,15 @@ export function parseRuleEntries(
111
134
  if (typeof v !== "object" || v === null || Array.isArray(v))
112
135
  return bad(`${where} must be an object of rule id → severity`);
113
136
  const out: Record<string, RuleEntry> = {};
114
- for (const [id, raw] of Object.entries(v)) {
137
+ for (const e of Object.entries(v).flatMap(expandEntry)) {
138
+ if (e.kind === "set-options")
139
+ return bad(
140
+ `${where}["${e.set}"]: ${JSON.stringify(e.raw)} — a rule set takes a severity alone ("off", "warn" or "error"); give one member its options in its own entry after the set`,
141
+ );
142
+ const { id, raw } = e;
115
143
  if (!shipped.has(id))
116
144
  return bad(
117
- `${where}: "${id}" is not a rule paperlint ships — known: ${[...shipped].sort().join(", ")}`,
145
+ `${where}: "${id}" is not a rule paperlint ships — known: ${[...shipped].sort().join(", ")}; rule sets: ${[...RULE_SETS.keys()].join(", ")}`,
118
146
  );
119
147
  const entry = parseEntry(raw);
120
148
  if (entry === null)
@@ -324,6 +324,29 @@ describe("tex/template — the shipped ACM and ACL templates", () => {
324
324
  ).toEqual([]);
325
325
  });
326
326
 
327
+ it("🔴 acmart without acmsmall — the manuscript or the sigconf format — fails the single-column family and FSE", () => {
328
+ const FSE = { extends: "paperlint:fse", kind: "research" };
329
+ for (const settings of [{ extends: "paperlint:acm-acmsmall" }, FSE])
330
+ for (const cls of [
331
+ "\\documentclass{acmart}",
332
+ "\\documentclass[sigconf,review,anonymous]{acmart}",
333
+ ])
334
+ expect(lint(paper(cls), settings)).toEqual([
335
+ {
336
+ rule: "tex/template",
337
+ messageId: "missingOption",
338
+ message: `the class option \`acmsmall\` is missing: ${settings === FSE ? "FSE 2027" : "acm-acmsmall"} requires \`\\documentclass[acmsmall]{acmart}\``,
339
+ line: 2,
340
+ },
341
+ ]);
342
+ // The call's own line, and acmsmall without the options it only encourages.
343
+ for (const cls of [
344
+ "\\documentclass[acmsmall,screen,review,anonymous]{acmart}",
345
+ "\\documentclass[acmsmall]{acmart}",
346
+ ])
347
+ expect(lint(paper(cls), FSE)).toEqual([]);
348
+ });
349
+
327
350
  it("an ACL paper — article at 11pt, acl.sty as a package — passes realm", () => {
328
351
  expect(
329
352
  lint(paper("\\documentclass[11pt]{article}\n\\usepackage[review]{acl}"), {
@@ -694,6 +717,17 @@ describe("tex/required-section — what fails", () => {
694
717
  });
695
718
  });
696
719
 
720
+ describe("tex/venue-leftover — FSE is named by its edition", () => {
721
+ it("🔴 «FSE 2027» in another venue's paper warns; FSE papers cited by other years do not", () => {
722
+ const leftover = (body: string) =>
723
+ lint(aidcPaper(body + STATEMENT), AIDC)
724
+ .filter((f) => f.rule === "tex/venue-leftover")
725
+ .map((f) => f.messageId);
726
+ expect(leftover("First written for FSE 2027.\n")).toEqual(["leftover"]);
727
+ expect(leftover("As shown at ESEC/FSE 2023 and FSE 2024.\n")).toEqual([]);
728
+ });
729
+ });
730
+
697
731
  describe("tex/required-section — the edges", () => {
698
732
  it("an unmarked section after the bibliography is back matter, not body", () => {
699
733
  // A statement, then the bibliography, then an unmarked section: that section is back matter.
@@ -830,6 +864,23 @@ describe("tex/venue-leftover — a workshop's parent conference (`parent`) is th
830
864
  ).toEqual([]);
831
865
  });
832
866
 
867
+ it("🔴 FSE and ASE do not collide: an AgenticDev paper names ASE as its own and FSE 2027 as another venue; an FSE paper reports ASE", () => {
868
+ expect(
869
+ named(lint(agenticdev("At ASE 2026, after FSE 2027."), AGENTICDEV)),
870
+ ).toEqual([["FSE 2027", "FSE 2027"]]);
871
+ expect(
872
+ named(
873
+ lint(
874
+ paper(
875
+ "\\documentclass[acmsmall]{acmart}",
876
+ "Formerly at ASE 2026, now FSE 2027.\nText.",
877
+ ),
878
+ { extends: "paperlint:fse", kind: "research" },
879
+ ),
880
+ ),
881
+ ).toEqual([["ASE", "ASE"]]);
882
+ });
883
+
833
884
  it("the parent's names are the paper's own, not the workshop's: AgenticDev still reports AISec", () => {
834
885
  expect(
835
886
  named(lint(agenticdev("ASE 2026, after AISec."), AGENTICDEV)),
@@ -1037,6 +1088,7 @@ describe("otherVenues", () => {
1037
1088
  expect(aidc.ok).toBe(true);
1038
1089
  if (!aidc.ok) return;
1039
1090
  expect(otherVenues(aidc.value, deps).map((o) => o.label)).toEqual([
1091
+ "acm-acmsmall",
1040
1092
  "acm-sigconf",
1041
1093
  "AGENT 2027",
1042
1094
  "AgenticDev",
@@ -1044,6 +1096,7 @@ describe("otherVenues", () => {
1044
1096
  "AISec",
1045
1097
  "ASE",
1046
1098
  "ACM CCS",
1099
+ "FSE 2027",
1047
1100
  "ICSE 2028",
1048
1101
  "MSR",
1049
1102
  "NLBSE",
@@ -271,13 +271,13 @@ describe("pdf/profile — the declaration must resolve, or nothing is judged", (
271
271
  "an unknown venue (a typo would silently disable every check)",
272
272
  { extends: "paperlint:agentic-dev", kind: "short" },
273
273
  "preset",
274
- /agent, agenticdev, agentverify, aidc, aisec, ase, ccs, icse, ieee-conference, msr, nlbse, realm, sp/,
274
+ /agent, agenticdev, agentverify, aidc, aisec, ase, ccs, fse, icse, ieee-conference, msr, nlbse, realm, sp/,
275
275
  ],
276
276
  [
277
277
  "the base TeX set is not a venue",
278
278
  { extends: "paperlint:tex-base" },
279
279
  "preset",
280
- /agent, agenticdev, agentverify, aidc, aisec, ase, ccs, icse, ieee-conference, msr, nlbse, realm, sp/,
280
+ /agent, agenticdev, agentverify, aidc, aisec, ase, ccs, fse, icse, ieee-conference, msr, nlbse, realm, sp/,
281
281
  ],
282
282
  [
283
283
  "paperlint.json that is not JSON",
@@ -782,6 +782,136 @@ describe("the IEEE conference family and AIDC", () => {
782
782
  });
783
783
  });
784
784
 
785
+ /**
786
+ * The facts of acmart's own `acmsmall-conf.tex` sample, measured for acm-acmsmall.jsonc
787
+ * (2026-11-19) without its appendix: banal's page, columns and sizes, pdf.js's fonts.
788
+ */
789
+ const acmsmallFacts = (patch: Patch = () => {}): Facts =>
790
+ withFacts((f) => {
791
+ f.page_w_in = 6.75;
792
+ f.page_h_in = 10;
793
+ f.columns = 1;
794
+ f.body_pt = 10.3;
795
+ f.ref_pt = 8.3;
796
+ f.npages = 10;
797
+ f.body_pages = 8;
798
+ f.ref_pages = 1;
799
+ f.fonts = type1([
800
+ "LinBiolinumT",
801
+ "LinBiolinumTB",
802
+ "LinLibertineT",
803
+ "LinLibertineTB",
804
+ "LinLibertineTI",
805
+ "Inconsolatazi4-Regular",
806
+ ]);
807
+ patch(f);
808
+ });
809
+
810
+ const ACMSMALL = { extends: "paperlint:acm-acmsmall" };
811
+ const FSE = {
812
+ extends: "paperlint:fse",
813
+ kind: "research",
814
+ identity: ["Ada Example", "adaexample", "ada@example.org"],
815
+ };
816
+
817
+ describe("the ACM single-column family and FSE", () => {
818
+ it.each([
819
+ ["the family", ACMSMALL],
820
+ ["fse/research", FSE],
821
+ ])("the measured acmsmall build passes %s", (_, venue) => {
822
+ expect(lint({ venue, facts: acmsmallFacts() })).toEqual([]);
823
+ });
824
+
825
+ it.each([
826
+ ["the family", ACMSMALL],
827
+ ["fse", FSE],
828
+ ])(
829
+ "🔴 the planted sigconf build fails %s: page, columns and body size",
830
+ (_, venue) => {
831
+ const facts = acmsmallFacts((f) => {
832
+ f.page_w_in = 8.5;
833
+ f.page_h_in = 11;
834
+ f.columns = 2;
835
+ f.body_pt = 9.3;
836
+ f.body_pages = 6;
837
+ });
838
+ expect(ids(lint({ venue, facts }))).toEqual([
839
+ "pdf/body-size:body",
840
+ "pdf/geometry:columns",
841
+ "pdf/geometry:dim",
842
+ "pdf/geometry:dim",
843
+ ]);
844
+ },
845
+ );
846
+
847
+ it("🔴 the planted Computer Modern build fails: no Biolinum for the headings", () => {
848
+ const facts = acmsmallFacts(
849
+ (f) =>
850
+ (f.fonts = type1([
851
+ "LinLibertineT",
852
+ "SFRM1000",
853
+ "SFSX1440",
854
+ "SFSS0900",
855
+ ])),
856
+ );
857
+ const fs = lint({ venue: ACMSMALL, facts });
858
+ expect(ids(fs)).toEqual(["pdf/fonts:noFamily"]);
859
+ expect(fs[0]?.message).toMatch(/LinBiolinum/);
860
+ });
861
+
862
+ it("🔴 a bibliography in \\small instead of the class's 8 pt fails pdf/body-size", () => {
863
+ const fs = lint({
864
+ venue: ACMSMALL,
865
+ facts: acmsmallFacts((f) => (f.ref_pt = 9.3)),
866
+ });
867
+ expect(fs.map((f) => f.message)).toEqual([
868
+ "the reference font size is 9.3 pt, outside 8 pt for acm-acmsmall (allowing ±0.5 pt for the measuring drift) — fix the bibliography's font size",
869
+ ]);
870
+ });
871
+ });
872
+
873
+ describe("format/page-limit on FSE: 18 body pages and 4 of references, 20 and 4 after a major revision", () => {
874
+ const REVISION = { ...FSE, kind: "major-revision" };
875
+ it.each([
876
+ { name: "research: 18 + 4 pass", venue: FSE, body: 18, refs: 4, want: [] },
877
+ {
878
+ name: "🔴 research: a 19th body page fails",
879
+ venue: FSE,
880
+ body: 19,
881
+ refs: 4,
882
+ want: ["format/page-limit:pages"],
883
+ },
884
+ {
885
+ name: "🔴 research: a 5th page of references fails",
886
+ venue: FSE,
887
+ body: 18,
888
+ refs: 5,
889
+ want: ["format/page-limit:pages"],
890
+ },
891
+ {
892
+ name: "major-revision: 20 + 4 pass",
893
+ venue: REVISION,
894
+ body: 20,
895
+ refs: 4,
896
+ want: [],
897
+ },
898
+ {
899
+ name: "🔴 major-revision: a 21st body page fails",
900
+ venue: REVISION,
901
+ body: 21,
902
+ refs: 4,
903
+ want: ["format/page-limit:pages"],
904
+ },
905
+ ])("$name", ({ venue, body, refs, want }) => {
906
+ const facts = acmsmallFacts((f) => {
907
+ f.body_pages = body;
908
+ f.ref_pages = refs;
909
+ f.npages = body + refs;
910
+ });
911
+ expect(ids(lint({ venue, facts }))).toEqual(want);
912
+ });
913
+ });
914
+
785
915
  describe("pdf/body-size on the IEEE family: 10 pt body, 8 pt references", () => {
786
916
  it("a body size off the family's 10 pt fails pdf/body-size", () => {
787
917
  expect(