paperlint 18.2.2 β†’ 18.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.
@@ -7,6 +7,7 @@ import { latexReader } from "./adapters/latex/index.ts";
7
7
  import { memoryFiles } from "./adapters/memory/index.ts";
8
8
  import { sourcesCodec } from "./adapters/sources-record/index.ts";
9
9
  import {
10
+ DEFAULT_MAX_PARAGRAPH_NUMBERS,
10
11
  DEFAULT_MAX_PARAGRAPH_WORDS,
11
12
  judgeCaptionWords,
12
13
  judgeParagraphNumbers,
@@ -44,21 +45,21 @@ const found = (body: string) =>
44
45
  ).map((f) => f.data);
45
46
 
46
47
  describe("tex/max-paragraph-words β€” a paragraph over the ceiling, and only that", () => {
47
- it("πŸ”΄ 151 words: fires, with the count, the ceiling and the paragraph's first words", () => {
48
+ it("πŸ”΄ 251 words: fires, with the count, the ceiling and the paragraph's first words", () => {
48
49
  // Guards: the case that was a false green once β€” a long single sentence tripped a sentence
49
50
  // ceiling and never the paragraph one. Here every sentence is at most ten words.
50
- expect(found(paragraph(151))).toEqual([
51
+ expect(found(paragraph(251))).toEqual([
51
52
  {
52
- words: 151,
53
- max: 150,
53
+ words: 251,
54
+ max: 250,
54
55
  head: "The rule reads the body and counts what…",
55
56
  },
56
57
  ]);
57
58
  });
58
59
 
59
- it("150 words and a short paragraph: silent", () => {
60
- // Guards: the ceiling is inclusive β€” 150 is allowed.
61
- expect(found(paragraph(150))).toEqual([]);
60
+ it("250 words and a short paragraph: silent", () => {
61
+ // Guards: the ceiling is inclusive β€” 250 is allowed.
62
+ expect(found(paragraph(250))).toEqual([]);
62
63
  expect(found(paragraph(30))).toEqual([]);
63
64
  });
64
65
 
@@ -89,9 +90,9 @@ describe("maxOf β€” the ceiling a config sets", () => {
89
90
  it("the option when it is set, the default otherwise", () => {
90
91
  // Guards: ESLint has validated the option; anything else falls back to the default.
91
92
  expect(maxOf([{ max: 120 }])).toBe(120);
92
- expect(maxOf([])).toBe(150);
93
- expect(maxOf(undefined)).toBe(150);
94
- expect(maxOf(["warn"])).toBe(150);
93
+ expect(maxOf([])).toBe(250);
94
+ expect(maxOf(undefined)).toBe(250);
95
+ expect(maxOf(["warn"])).toBe(250);
95
96
  });
96
97
  });
97
98
 
@@ -128,13 +129,13 @@ describe("the rule, through its create()", () => {
128
129
  };
129
130
 
130
131
  it("reports at the paragraph's first line, with its message id", () => {
131
- expect(reported(paragraph(160))).toEqual([
132
+ expect(reported(paragraph(260))).toEqual([
132
133
  {
133
134
  loc: { start: { line: 3, column: 0 }, end: { line: 3, column: 0 } },
134
135
  messageId: "paragraph",
135
136
  data: {
136
- words: 160,
137
- max: 150,
137
+ words: 260,
138
+ max: 250,
138
139
  head: "The rule reads the body and counts what…",
139
140
  },
140
141
  },
@@ -143,65 +144,67 @@ describe("the rule, through its create()", () => {
143
144
 
144
145
  it("a source without a raw text is read from its text", () => {
145
146
  // Guards: ESLint's source code may carry no `raw`; the rule falls back to `text`.
146
- expect(reported(paragraph(160), [], false)).toHaveLength(1);
147
+ expect(reported(paragraph(260), [], false)).toHaveLength(1);
147
148
  });
148
149
 
149
- it("an option moves the ceiling: 140 words fire under max 120, not under the default", () => {
150
- expect(reported(paragraph(140), [{ max: 120 }])).toHaveLength(1);
151
- expect(reported(paragraph(140))).toHaveLength(0);
150
+ it("an option moves the ceiling: 240 words fire under max 120, not under the default", () => {
151
+ expect(reported(paragraph(240), [{ max: 120 }])).toHaveLength(1);
152
+ expect(reported(paragraph(240))).toHaveLength(0);
152
153
  });
153
154
  });
154
155
 
155
156
  /** What the numbers judge finds in `body` at the default ceiling. */
156
157
  const numbersFound = (body: string) => {
157
158
  const src = doc(body);
158
- return judgeParagraphNumbers(latexReader.bodyProse(src), 8).map(
159
- (f) => f.data,
160
- );
159
+ return judgeParagraphNumbers(
160
+ latexReader.bodyProse(src),
161
+ DEFAULT_MAX_PARAGRAPH_NUMBERS,
162
+ ).map((f) => f.data);
161
163
  };
162
164
 
163
165
  describe("tex/max-paragraph-numbers", () => {
164
- it("πŸ”΄ nine numbers fire, eight stay quiet; citations and references are not numbers, a hand-typed place is", () => {
165
- const eight =
166
- "We ran 1 and 2.5 and 30\\% and 4,000 and \\numA{} and \\numTotal and 7 and 8.";
167
- expect(numbersFound(eight)).toEqual([]);
168
- expect(numbersFound(`${eight} Then 9.`)).toEqual([
169
- { numbers: 9, max: 8, head: "We ran 1 and 2.5 and 30% and…" },
166
+ it("πŸ”΄ eleven numbers fire, ten stay quiet; citations and references are not numbers, a hand-typed place is", () => {
167
+ const ten =
168
+ "We ran 1 and 2.5 and 30\\% and 4,000 and \\numA{} and \\numTotal and 7 and 8 and 9 and 10.";
169
+ expect(numbersFound(ten)).toEqual([]);
170
+ expect(numbersFound(`${ten} Then 11.`)).toEqual([
171
+ { numbers: 11, max: 10, head: "We ran 1 and 2.5 and 30% and…" },
170
172
  ]);
171
173
  // Guards: a citation key and a reference are not quantities.
172
- expect(
173
- numbersFound(`${eight} See \\cite{k2024} and \\ref{sec:1}.`),
174
- ).toEqual([]);
174
+ expect(numbersFound(`${ten} See \\cite{k2024} and \\ref{sec:1}.`)).toEqual(
175
+ [],
176
+ );
175
177
  // A place typed by hand is a number like any other; written with \\ref it is not.
176
- expect(numbersFound(`${eight} See Section 3.2.`)).toEqual([
177
- { numbers: 9, max: 8, head: "We ran 1 and 2.5 and 30% and…" },
178
+ expect(numbersFound(`${ten} See Section 3.2.`)).toEqual([
179
+ { numbers: 11, max: 10, head: "We ran 1 and 2.5 and 30% and…" },
178
180
  ]);
179
- expect(numbersFound(`${eight} See Section \\ref{sec:x}.`)).toEqual([]);
181
+ expect(numbersFound(`${ten} See Section \\ref{sec:x}.`)).toEqual([]);
180
182
  });
181
183
 
182
- /** Eight numbers a reader sees, none of them a `\num…` macro. */
183
- const EIGHT = "We ran 1 and 2 and 3 and 4 and 5 and 6 and 7 and 8 times.";
184
+ /** Ten numbers a reader sees, none of them a `\num…` macro. */
185
+ const TEN =
186
+ "We ran 1 and 2 and 3 and 4 and 5 and 6 and 7 and 8 and 9 and 10 times.";
184
187
 
185
- it("πŸ”΄ a `\\num…` macro in the paragraph's prose counts: the ninth fires", () => {
186
- expect(numbersFound(`${EIGHT} Then \\numFoo{} more.`)).toEqual([
187
- { numbers: 9, max: 8, head: "We ran 1 and 2 and 3 and…" },
188
+ it("πŸ”΄ a `\\num…` macro in the paragraph's prose counts: the eleventh fires", () => {
189
+ expect(numbersFound(`${TEN} Then \\numFoo{} more.`)).toEqual([
190
+ { numbers: 11, max: 10, head: "We ran 1 and 2 and 3 and…" },
188
191
  ]);
189
192
  });
190
193
 
191
194
  it("πŸ”΄ a `\\num…` macro inside inline math is math, not prose: not counted", () => {
192
195
  // Guards: the source between the paragraph's first and last piece holds the macro.
193
- expect(numbersFound(`${EIGHT} Then $\\num{9}$ more.`)).toEqual([]);
196
+ expect(numbersFound(`${TEN} Then $\\num{9}$ more.`)).toEqual([]);
194
197
  });
195
198
 
196
199
  it("πŸ”΄ a `\\num…` macro on a commented-out line is not counted", () => {
197
200
  // Guards: a comment changes nothing on the page, so it cannot add a number.
198
- expect(numbersFound(`${EIGHT}\n% \\numFoo\nThen more.`)).toEqual([]);
201
+ expect(numbersFound(`${TEN}\n% \\numFoo\nThen more.`)).toEqual([]);
199
202
  });
200
203
 
201
204
  it("πŸ”΄ a `\\num…` macro in a footnote counts for the footnote, not for the paragraph it hangs from", () => {
202
205
  // Guards: a footnote is a passage of its own; its numbers are its own.
203
206
  expect(
204
- numbersFound(`${EIGHT}\\footnote{See \\numFoo{}.} Then more.`),
207
+ numbersFound(`${TEN}\\footnote{See \\numFoo{}.} Then more.`),
205
208
  ).toEqual([]);
206
209
  });
207
210
  });
@@ -291,7 +294,7 @@ describe("the new rules, through create()", () => {
291
294
  const long = Array.from({ length: 60 }, () => "word").join(" ");
292
295
  expect(run(maxSentenceWordsRule(deps), `${long}.`)).toHaveLength(1);
293
296
  expect(
294
- run(maxParagraphNumbersRule(deps), "1 2 3 4 5 6 7 8 9."),
297
+ run(maxParagraphNumbersRule(deps), "1 2 3 4 5 6 7 8 9 10 11."),
295
298
  ).toHaveLength(1);
296
299
  expect(run(maxParagraphWordsRule(deps), "Short.")).toHaveLength(0);
297
300
  });
@@ -1,17 +1,20 @@
1
1
  /**
2
2
  * THE PARAGRAPH CEILING β€” `tex/max-paragraph-words`, a rule of the `tex` plugin over the body's
3
- * prose: a paragraph runs past `max` words (default 150).
3
+ * prose: a paragraph runs past `max` words (default 250).
4
4
  *
5
5
  * ── OFF BY DEFAULT ───────────────────────────────────────────────────────────────
6
6
  * No call for papers states a paragraph limit, so no venue is a source for the number. The rule is
7
7
  * registered and silent until a project turns it on in its `rules`, as `tex/heading-case` is. The
8
8
  * name and the `max` option follow ESLint's own `max-lines`, `max-len`, `max-statements`.
9
9
  *
10
- * ── WHERE 150 COMES FROM ─────────────────────────────────────────────────────────
11
- * The wall writing-craft.md names (Β«The wall-of-text checkΒ»), measured
12
- * with this rule's counter on the accepted papers in `fixtures/real-papers/accepted/`: it sits at the
13
- * pooled 95th percentile of paragraph length of the five two-column IEEE ones (154). The measurement
14
- * is on the rule's page. A paragraph is at most `max` words; 150 is allowed.
10
+ * ── WHERE 250 COMES FROM ─────────────────────────────────────────────────────────
11
+ * The 99th percentile of paragraph length over the accepted real papers in
12
+ * `fixtures/real-papers/accepted/` (96 papers with at least 2,500 body words, 7,994 paragraphs,
13
+ * measured with this rule's counter): p99 is 252, so 250 leaves about 1% of accepted paragraphs
14
+ * over it. The author chose it on 2026-11-20. It rests on what 99% of accepted paragraphs pass, not
15
+ * on reviewer evidence: a pilot on ICLR 2025 presentation scores found no link between long
16
+ * paragraphs and the score (inconclusive). The measurement is on the rule's page. A paragraph is
17
+ * at most `max` words; 250 is allowed.
15
18
  *
16
19
  * ── WHAT IT READS ────────────────────────────────────────────────────────────────
17
20
  * The body's prose through the `LatexReader` port (`bodyProse`): paragraphs, list items and
@@ -40,10 +43,10 @@ import {
40
43
  } from "./tex-venue-rules.ts";
41
44
 
42
45
  /** The ceiling when the config sets none: the largest paragraph that does not fire. */
43
- export const DEFAULT_MAX_PARAGRAPH_WORDS = 150;
46
+ export const DEFAULT_MAX_PARAGRAPH_WORDS = 250;
44
47
 
45
- /** The numbers ceiling when the config sets none: a ninth number fires. */
46
- export const DEFAULT_MAX_PARAGRAPH_NUMBERS = 8;
48
+ /** The numbers ceiling when the config sets none: an eleventh number fires. */
49
+ export const DEFAULT_MAX_PARAGRAPH_NUMBERS = 10;
47
50
 
48
51
  /** The sentence ceiling when the config sets none: a 56th word fires. */
49
52
  export const DEFAULT_MAX_SENTENCE_WORDS = 55;
@@ -1373,21 +1373,21 @@ const CASES: Readonly<Record<string, RuleCases>> = {
1373
1373
  // below): its cases turn it on in the paper's paperlint.json, as study/declare-sample's do.
1374
1374
  "tex/max-paragraph-words": {
1375
1375
  reports: {
1376
- tree: paper(tex(wordsParagraph(151)), MAX_PARAGRAPH_WORDS_ON),
1376
+ tree: paper(tex(wordsParagraph(251)), MAX_PARAGRAPH_WORDS_ON),
1377
1377
  file: TEX_FILE,
1378
1378
  severity: 1,
1379
1379
  line: 3,
1380
1380
  },
1381
- silent: paper(tex(wordsParagraph(150)), MAX_PARAGRAPH_WORDS_ON),
1381
+ silent: paper(tex(wordsParagraph(250)), MAX_PARAGRAPH_WORDS_ON),
1382
1382
  },
1383
1383
  "tex/max-paragraph-numbers": {
1384
1384
  reports: {
1385
- tree: paper(tex(numbersParagraph(9)), CEILINGS_ON),
1385
+ tree: paper(tex(numbersParagraph(11)), CEILINGS_ON),
1386
1386
  file: TEX_FILE,
1387
1387
  severity: 1,
1388
1388
  line: 3,
1389
1389
  },
1390
- silent: paper(tex(numbersParagraph(8)), CEILINGS_ON),
1390
+ silent: paper(tex(numbersParagraph(10)), CEILINGS_ON),
1391
1391
  },
1392
1392
  "tex/max-sentence-words": {
1393
1393
  reports: {
@@ -1842,10 +1842,10 @@ describe("tex/max-paragraph-words is off by default", () => {
1842
1842
  });
1843
1843
 
1844
1844
  describe("the other two ceilings are off by default", () => {
1845
- it("nine numbers and a 56-word sentence produce nothing under the default config", async () => {
1845
+ it("eleven numbers and a 56-word sentence produce nothing under the default config", async () => {
1846
1846
  const ids = async (tree: Record<string, string>) =>
1847
1847
  (await lintTree(tree)).map((m) => m.ruleId);
1848
- const body = `${numbersParagraph(9)} ${longSentence(56)}`;
1848
+ const body = `${numbersParagraph(11)} ${longSentence(56)}`;
1849
1849
  const off = await ids(paper(tex(body)));
1850
1850
  expect(off).not.toContain("tex/max-paragraph-numbers");
1851
1851
  expect(off).not.toContain("tex/max-sentence-words");