paperlint 4.2.0 → 5.0.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 (119) hide show
  1. package/CLAUDE.md +2 -2
  2. package/README.md +15 -4
  3. package/action.harness.mjs +54 -36
  4. package/action.yml +12 -27
  5. package/dist/adapters/latex/includes.d.ts +5 -1
  6. package/dist/adapters/latex/includes.d.ts.map +1 -1
  7. package/dist/adapters/latex/includes.js +8 -2
  8. package/dist/adapters/latex/includes.js.map +1 -1
  9. package/dist/build.d.ts.map +1 -1
  10. package/dist/build.js +7 -3
  11. package/dist/build.js.map +1 -1
  12. package/dist/cli.d.ts +2 -8
  13. package/dist/cli.d.ts.map +1 -1
  14. package/dist/cli.js +67 -37
  15. package/dist/cli.js.map +1 -1
  16. package/dist/domain/paper-source.js +2 -2
  17. package/dist/eslint-rules/latex-language.d.ts +5 -1
  18. package/dist/eslint-rules/latex-language.d.ts.map +1 -1
  19. package/dist/eslint-rules/latex-language.js +6 -3
  20. package/dist/eslint-rules/latex-language.js.map +1 -1
  21. package/dist/eslint-rules/paper-context.d.ts +20 -0
  22. package/dist/eslint-rules/paper-context.d.ts.map +1 -0
  23. package/dist/eslint-rules/paper-context.js +44 -0
  24. package/dist/eslint-rules/paper-context.js.map +1 -0
  25. package/dist/eslint-rules/paper-typography.d.ts +1 -1
  26. package/dist/eslint-rules/paper-typography.d.ts.map +1 -1
  27. package/dist/eslint-rules/paper-typography.js +32 -18
  28. package/dist/eslint-rules/paper-typography.js.map +1 -1
  29. package/dist/eslint-rules/tex-build.d.ts.map +1 -1
  30. package/dist/eslint-rules/tex-build.js +7 -1
  31. package/dist/eslint-rules/tex-build.js.map +1 -1
  32. package/dist/init.d.ts +4 -19
  33. package/dist/init.d.ts.map +1 -1
  34. package/dist/init.js +24 -29
  35. package/dist/init.js.map +1 -1
  36. package/dist/package-dirs.d.ts +2 -0
  37. package/dist/package-dirs.d.ts.map +1 -1
  38. package/dist/package-dirs.js +8 -0
  39. package/dist/package-dirs.js.map +1 -1
  40. package/dist/paper-files.d.ts +2 -2
  41. package/dist/paper-includes.d.ts +17 -0
  42. package/dist/paper-includes.d.ts.map +1 -0
  43. package/dist/paper-includes.js +51 -0
  44. package/dist/paper-includes.js.map +1 -0
  45. package/dist/rules-config.d.ts +1 -0
  46. package/dist/rules-config.d.ts.map +1 -1
  47. package/dist/rules-config.js.map +1 -1
  48. package/dist/structure.js +1 -1
  49. package/dist/structure.js.map +1 -1
  50. package/dist/tex-paper.d.ts +17 -3
  51. package/dist/tex-paper.d.ts.map +1 -1
  52. package/dist/tex-paper.js +36 -38
  53. package/dist/tex-paper.js.map +1 -1
  54. package/docs/configuration.md +5 -4
  55. package/docs/install.md +8 -8
  56. package/docs/prior-art/paper-folder-scaffolding.md +4 -7
  57. package/docs/rules.md +15 -11
  58. package/eslint-rules/latex-language.ts +10 -4
  59. package/eslint-rules/paper-context.test.ts +47 -0
  60. package/eslint-rules/paper-context.ts +57 -0
  61. package/eslint-rules/paper-typography.ts +67 -23
  62. package/eslint-rules/tex-build.ts +8 -1
  63. package/fixtures/real-markdown-paper/baseline.json +1 -2
  64. package/package.json +1 -1
  65. package/scripts/check.ts +2 -2
  66. package/scripts/eslint-report-guard.mjs +5 -2
  67. package/scripts/harness-api.frozen.json +0 -1
  68. package/skills/paper-pipeline/references/pipeline-status-template.md +2 -16
  69. package/src/adapters/latex/includes.ts +10 -2
  70. package/src/adapters/latex/index.test.ts +8 -0
  71. package/src/build.harness.mjs +4 -2
  72. package/src/build.test.ts +18 -1
  73. package/src/build.ts +7 -3
  74. package/src/cli.harness.mjs +22 -54
  75. package/src/cli.test.ts +2 -18
  76. package/src/cli.ts +78 -42
  77. package/src/domain/paper-source.ts +2 -2
  78. package/src/init.test.ts +33 -13
  79. package/src/init.ts +25 -48
  80. package/src/linted-set.test.ts +11 -1
  81. package/src/new-paper.harness.mjs +1 -5
  82. package/src/package-dirs.ts +9 -0
  83. package/src/paper-files.ts +2 -2
  84. package/src/paper-includes.test.ts +161 -0
  85. package/src/paper-includes.ts +77 -0
  86. package/src/rule-cases.test.ts +0 -30
  87. package/src/rule-docs.test.ts +0 -1
  88. package/src/rules-config.ts +1 -0
  89. package/src/structure.harness.ts +1 -3
  90. package/src/structure.ts +1 -1
  91. package/src/tex-paper.test.ts +78 -61
  92. package/src/tex-paper.ts +57 -48
  93. package/src/tex-venue-rules.test.ts +1 -1
  94. package/templates/paper/PIPELINE-STATUS.md +0 -4
  95. package/dist/action-ref.d.ts +0 -12
  96. package/dist/action-ref.d.ts.map +0 -1
  97. package/dist/action-ref.js +0 -16
  98. package/dist/action-ref.js.map +0 -1
  99. package/dist/eslint-rules/paper-research-question.d.ts +0 -31
  100. package/dist/eslint-rules/paper-research-question.d.ts.map +0 -1
  101. package/dist/eslint-rules/paper-research-question.js +0 -188
  102. package/dist/eslint-rules/paper-research-question.js.map +0 -1
  103. package/docs/rules/tex/missing-input.md +0 -58
  104. package/eslint-rules/paper-research-question.harness.mjs +0 -212
  105. package/eslint-rules/paper-research-question.ts +0 -199
  106. package/fixtures/paper-research-question/comment-only/PIPELINE-STATUS.md +0 -9
  107. package/fixtures/paper-research-question/comment-only/paper.tex +0 -7
  108. package/fixtures/paper-research-question/declared-not-in-paper/PIPELINE-STATUS.md +0 -10
  109. package/fixtures/paper-research-question/declared-not-in-paper/paper.tex +0 -6
  110. package/fixtures/paper-research-question/draft/PIPELINE-STATUS.md +0 -6
  111. package/fixtures/paper-research-question/draft/paper.tex +0 -2
  112. package/fixtures/paper-research-question/markdown-no-rq/PIPELINE-STATUS.md +0 -9
  113. package/fixtures/paper-research-question/markdown-no-rq/paper.md +0 -4
  114. package/fixtures/paper-research-question/shipped-no-rq/PIPELINE-STATUS.md +0 -12
  115. package/fixtures/paper-research-question/shipped-no-rq/paper.tex +0 -3
  116. package/fixtures/paper-research-question/shipped-with-rq/PIPELINE-STATUS.md +0 -10
  117. package/fixtures/paper-research-question/shipped-with-rq/paper.tex +0 -2
  118. package/src/action-ref.test.ts +0 -26
  119. package/src/action-ref.ts +0 -15
@@ -1,16 +0,0 @@
1
- /**
2
- * The ref `paperlint init` pins the GitHub Action to, decided from the version of the package that is
3
- * running. semantic-release tags every release `v<version>` on the commit it publishes, so the
4
- * action at that tag is the same code as the installed package.
5
- *
6
- * Only a plain `X.Y.Z` has such a tag. A git checkout or `npm link` carries the unreleased
7
- * placeholder `0.0.0-semantically-released`, a version that could not be read is `undefined`, and
8
- * anything else is not known to be tagged: those return `null` ("no pin known"), and the caller
9
- * keeps the placeholder. A wrong tag written confidently is worse than an obvious placeholder.
10
- */
11
- export function actionRef(version) {
12
- return version !== undefined && /^\d+\.\d+\.\d+$/.test(version)
13
- ? `v${version}`
14
- : null;
15
- }
16
- //# sourceMappingURL=action-ref.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"action-ref.js","sourceRoot":"","sources":["../src/action-ref.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,UAAU,SAAS,CAAC,OAA2B;IACnD,OAAO,OAAO,KAAK,SAAS,IAAI,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC;QAC7D,CAAC,CAAC,IAAI,OAAO,EAAE;QACf,CAAC,CAAC,IAAI,CAAC;AACX,CAAC"}
@@ -1,31 +0,0 @@
1
- import type { RuleContext } from "./rule-context.ts";
2
- declare const _default: {
3
- rules: {
4
- "research-question": {
5
- meta: {
6
- type: "suggestion";
7
- docs: {
8
- description: string;
9
- };
10
- schema: {
11
- type: string;
12
- properties: {
13
- statusFile: {
14
- type: string;
15
- };
16
- };
17
- additionalProperties: boolean;
18
- }[];
19
- messages: {
20
- notDeclared: string;
21
- notInPaper: string;
22
- };
23
- };
24
- create(context: RuleContext): {
25
- "root:exit"(node: object): void;
26
- };
27
- };
28
- };
29
- };
30
- export default _default;
31
- //# sourceMappingURL=paper-research-question.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"paper-research-question.d.ts","sourceRoot":"","sources":["../../eslint-rules/paper-research-question.ts"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;;;;;;;;;;;;;;;;;;;;;;;4BAuH/B,WAAW;kCAQL,MAAM;;;;;AApClC,wBAqEE"}
@@ -1,188 +0,0 @@
1
- /**
2
- * `paper/research-question` — a shipped paper states its research question EXPLICITLY.
3
- *
4
- * Reviewer A's verbatim point on agenticdev (#20), as it was parsed: "State the goal as a
5
- * research question." This is a venue expectation, not taste: an empirical paper that never
6
- * names the question it answers forces the reviewer to reconstruct it — and they say so.
7
- *
8
- * ── WHY THE SCOPE IS SHIPPED PAPERS ONLY ─────────────────────────────────────────────────
9
- * A draft never asked anyone to read it. The scope deliberately matches `paper/author-list`:
10
- * both are about the DEBT of a shipped paper, and an unshipped one has no debt. Measured on the
11
- * live corpus before the move:
12
- * agenticdev-2026 has RQ, shipped -> silent (added because of this very review)
13
- * aisec-2026 no RQ, shipped -> a finding
14
- * compile-rules no RQ, shipped -> a finding
15
- * scored-2026 no RQ, NOT shipped -> silent
16
- *
17
- * ── WHAT THE MOVE CHANGED ─────────────────────────────────────────────────────────────────
18
- * The predecessor read the stage with a REGEX OVER THE SCORECARD'S PROSE. Remeasured 2026-09-17:
19
- * for `agenticdev-2026` the prose reads `submitted`, while the `stages` field declares
20
- * `submitted, camera-ready`. Here the stage comes from the FIELD — the same one `paper/stages`
21
- * checks against the bytes in both directions.
22
- *
23
- * ⚠️ WHAT THE MOVE DOES NOT FIX, AND THIS IS MEASURED, NOT ASSUMED. The rule reads RAW text, not
24
- * the parsed tree, so a mention of RQ inside a LaTeX comment (`% add an RQ`) will put it to
25
- * sleep. Measured 2026-09-17 across all four papers: ZERO such cases — not a single match inside
26
- * a comment. So the hole is LATENT, not observed, and closing it with a tree walk would
27
- * complicate the rule without a measured difference. The neighboring `paper/typography` is built
28
- * the same way and for the same reason. Once a real case shows up, there will be something to
29
- * cite here.
30
- *
31
- * The rule is ADVISORY by decision, not by coincidence: a position paper may legitimately have
32
- * no question. Then its absence is the author's decision, and the rule says exactly that,
33
- * rather than declaring the absence a defect on its own.
34
- */
35
- import { existsSync, readFileSync } from "node:fs";
36
- import { join, dirname } from "node:path";
37
- import { load } from "js-yaml";
38
- import { z } from "zod";
39
- /**
40
- * The two scorecard fields this rule reads, parsed rather than trusted: a field of the wrong shape
41
- * reads as absent, the way `data?.stages` on a string or a number always did.
42
- */
43
- const Scorecard = z
44
- .looseObject({
45
- stages: z.array(z.unknown()).catch([]),
46
- researchQuestion: z.string().catch(""),
47
- })
48
- .catch({ stages: [], researchQuestion: "" });
49
- const StageEntry = z.looseObject({ stage: z.unknown().optional() }).catch({});
50
- const RuleOptions = z
51
- .object({ statusFile: z.string().default("PIPELINE-STATUS.md") })
52
- .default({ statusFile: "PIPELINE-STATUS.md" });
53
- /**
54
- * 🔴 THE REGEX IS GONE, AND THE REASON IS NOT "regexes are bad" — IT IS THAT IT ANSWERED THE
55
- * WRONG QUESTION (2026-09-19).
56
- *
57
- * What stood here was `/\\textbf\{RQ|\bRQ[0-9]?\b|research question/i`, defended in this very
58
- * file with: "a regex is LEGITIMATE here: the subject is human prose, which has no structure by
59
- * definition, and no parser can tell a question's statement apart from a paragraph about it."
60
- *
61
- * The premise is true. The conclusion does not follow. From "the text cannot decide this" the
62
- * answer is not "so pattern-match harder" — it is "so the HUMAN declares it, and the check
63
- * compares the declaration against the text." The three spellings were an undeclared schema
64
- * field: someone added a fact and invented a convention for how it would look in prose, which is
65
- * the design running backwards.
66
- *
67
- * What the pattern actually decided, in both directions:
68
- * • a paper that says "we leave the research question to future work" — MATCHED, and the rule
69
- * went silent on a paper that states no question at all;
70
- * • a paper whose question is written plainly ("Does pruning reduce review cost?") with no
71
- * "RQ" anywhere — NOT matched, and the rule reported a paper that does exactly what is asked.
72
- * An open list of spellings cannot be completed, so both failures are structural, not bugs.
73
- *
74
- * ── WHAT REPLACES IT: ONE UNDECIDABLE QUESTION BECOMES TWO DECIDABLE ONES ──────────────────
75
- * 1. Is the question WRITTEN DOWN? — `researchQuestion` in the scorecard's front matter. A
76
- * field, parsed by js-yaml, not a phrase hunted for in prose.
77
- * 2. Does the paper CONTAIN what was written down? — the declared sentence, whitespace
78
- * collapsed, compared against the source. Bytes, not spelling.
79
- *
80
- * This is the shape this package already uses twice, and for the same reason: `bytes`/
81
- * `sourceBytes` (a recorded number compared against the file on disk) and `paper/author-list`
82
- * (a recorded marker, because whether a cross-check ran is not visible in the paper). Neither
83
- * asks the prose a question the prose cannot answer.
84
- *
85
- * ⚠️ WHAT THIS STILL CANNOT DO, said plainly rather than implied: nothing here decides that the
86
- * declared sentence IS a research question. A declaration of "banana" passes step 1 and, if the
87
- * word appears in the paper, step 2. The rule guarantees that the author wrote a question down
88
- * and that the paper carries it — it does not grade the question. That is a human's job, and
89
- * pretending otherwise is what the regex was doing.
90
- */
91
- /** Whitespace is the only thing normalised: a sentence wrapped across lines is the same sentence. */
92
- const flatten = (t) => t.replace(/\s+/g, " ").trim().toLowerCase();
93
- /**
94
- * Both facts come out of ONE parse of the scorecard's front matter: the stages (has this paper
95
- * shipped?) and the declared question. Reading them separately would invite the two to be taken
96
- * from different revisions of the same file.
97
- */
98
- function scorecard(dir, statusName) {
99
- const p = join(dir, statusName);
100
- const none = { stages: [], question: "" };
101
- if (!existsSync(p))
102
- return none;
103
- let text;
104
- try {
105
- text = readFileSync(p, "utf-8");
106
- }
107
- catch {
108
- return none;
109
- }
110
- const m = /^---\n([\s\S]*?)\n---/.exec(text);
111
- if (!m)
112
- return none;
113
- const [, front = ""] = m;
114
- let data;
115
- try {
116
- data = load(front);
117
- }
118
- catch {
119
- return none; // the unreadable YAML is already reported by `paper/stages`, on its own file
120
- }
121
- const { stages: raw, researchQuestion: question } = Scorecard.parse(data);
122
- const stages = raw.map((r) => StageEntry.parse(r).stage).filter(Boolean);
123
- return { stages, question };
124
- }
125
- export default {
126
- rules: {
127
- "research-question": {
128
- meta: {
129
- type: "suggestion",
130
- docs: {
131
- description: "a paper that declares a stage states its research question explicitly — otherwise the reviewer reconstructs it themselves, and says so",
132
- },
133
- schema: [
134
- {
135
- type: "object",
136
- properties: {
137
- // The scorecard's name is a CONSUMER convention. The rule is declared on the
138
- // paper's source, so it has to name its neighbor itself rather than get it via a
139
- // config glob.
140
- statusFile: { type: "string" },
141
- },
142
- additionalProperties: false,
143
- },
144
- ],
145
- messages: {
146
- notDeclared: "the paper shipped (stage «{{stages}}») and its scorecard declares no `researchQuestion`. This is reviewer A's verbatim point on agenticdev (#20), not the linter's taste. Write the question down as a field, in your own words — the check cannot infer it from the prose, and the pattern that used to try matched «we leave the research question to future work» while missing a question stated plainly. Advisory: a position paper may legitimately have none, and then leaving the field out is a DECISION — record it as one",
147
- notInPaper: "the scorecard declares a research question the paper does not contain. Looked for «{{needle}}» with whitespace collapsed, and the source has no such run of text. Either the paper dropped it or the declaration drifted from what was written — and which of the two it is, only you know",
148
- },
149
- },
150
- create(context) {
151
- const { statusFile: statusName } = RuleOptions.parse(context.options[0]);
152
- return {
153
- // `root:exit` exists for both markdown and the `tex/latex` language — the same place
154
- // `paper/typography` lives, and for the same reason: a paper in this corpus can be
155
- // either.
156
- "root:exit"(node) {
157
- const raw = context.sourceCode.raw ?? context.sourceCode.text;
158
- if (typeof raw !== "string")
159
- return;
160
- const { stages, question } = scorecard(dirname(context.filename), statusName);
161
- if (stages.length === 0)
162
- return; // not shipped — owes nothing
163
- // Step 1 — is it written down? A field, not a phrase hunted for in prose.
164
- if (question.trim() === "") {
165
- context.report({
166
- node,
167
- messageId: "notDeclared",
168
- data: { stages: stages.join("/") },
169
- });
170
- return;
171
- }
172
- // Step 2 — does the paper carry what was written down? Bytes, not spelling. Only
173
- // whitespace is normalised, because a sentence wrapped across source lines is the
174
- // same sentence; everything else stays the author's.
175
- if (flatten(raw).includes(flatten(question)))
176
- return;
177
- context.report({
178
- node,
179
- messageId: "notInPaper",
180
- data: { needle: flatten(question) },
181
- });
182
- },
183
- };
184
- },
185
- },
186
- },
187
- };
188
- //# sourceMappingURL=paper-research-question.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"paper-research-question.js","sourceRoot":"","sources":["../../eslint-rules/paper-research-question.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;GAGG;AACH,MAAM,SAAS,GAAG,CAAC;KAChB,WAAW,CAAC;IACX,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;IACtC,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;CACvC,CAAC;KACD,KAAK,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,gBAAgB,EAAE,EAAE,EAAE,CAAC,CAAC;AAC/C,MAAM,UAAU,GAAG,CAAC,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAC9E,MAAM,WAAW,GAAG,CAAC;KAClB,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE,CAAC;KAChE,OAAO,CAAC,EAAE,UAAU,EAAE,oBAAoB,EAAE,CAAC,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,qGAAqG;AACrG,MAAM,OAAO,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,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EAAE;6BACnC,CAAC,CAAC;4BACH,OAAO;wBACT,CAAC;wBAED,iFAAiF;wBACjF,kFAAkF;wBAClF,qDAAqD;wBACrD,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;4BAAE,OAAO;wBACrD,OAAO,CAAC,MAAM,CAAC;4BACb,IAAI;4BACJ,SAAS,EAAE,YAAY;4BACvB,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE;yBACpC,CAAC,CAAC;oBACL,CAAC;iBACF,CAAC;YACJ,CAAC;SACF;KACF;CACF,CAAC"}
@@ -1,58 +0,0 @@
1
- # tex/missing-input
2
-
3
- **Level:** warn · **Reads:** `paper.tex`, and every file it includes
4
-
5
- ## What it catches
6
-
7
- An `\input`, `\include` or `\subfile` that names a file which is not there. The path is resolved the
8
- way TeX resolves it, from the paper's directory: `name.tex` first, then `name` as written. An
9
- include inside an included file is resolved from the paper's directory too.
10
-
11
- ## Why
12
-
13
- The rules that read the parse tree — `tex/template`, `tex/required-section`, `tex/venue-leftover`,
14
- `tex/claim-provenance` — read the whole paper: `paper.tex` with every included file spliced in where
15
- it is included, as TeX reads it. A file that is not there cannot be read, and without this rule the
16
- others would report a clean body for text they never saw. TeX stops on it too.
17
-
18
- ## Examples
19
-
20
- ```latex
21
- \input{sections/results} % warns when neither sections/results.tex nor sections/results exists
22
- \input{sections/intro} % silent: sections/intro.tex is there
23
- ```
24
-
25
- The first line reports:
26
-
27
- > `sections/results` is not there (tried `sections/results.tex` and `sections/results`, from the
28
- > paper's directory): TeX stops on it, and no rule read what it should hold
29
-
30
- A missing file included by another included file is reported at the include in `paper.tex` that
31
- brought that file in, and the message names the file that holds it.
32
-
33
- ## Options / preset fields
34
-
35
- None.
36
-
37
- ## What it does not check
38
-
39
- - A path built from a macro (`\input{\dir/intro}`): macros are not expanded, so the path is looked
40
- up as written.
41
- - `\import{dir}{file}` and other packages' include macros.
42
-
43
- ## How to fix
44
-
45
- Correct the path, or add the file. A file that a build step writes (a table of generated numbers)
46
- is absent before that step runs — keep the include with a disable directive and the reason:
47
-
48
- ```latex
49
- % eslint-disable-next-line tex/missing-input -- written by repro/numbers.sh before the build
50
- \input{generated/numbers}
51
- ```
52
-
53
- ## Where findings in included files are reported
54
-
55
- ESLint reports a finding in the file it lints, and paperlint lints `paper.tex`. A finding of any of
56
- the rules above whose text came from an included file is reported at the include in `paper.tex`,
57
- with the included file, line and column at the front of its message
58
- (`sections/results.tex:12:3: …`). A disable directive for it goes above that include.
@@ -1,212 +0,0 @@
1
- /**
2
- * Both halves for `paper/research-question`, plus two that a test forgets most often: SCOPE
3
- * and LANGUAGE.
4
- *
5
- * The scope is load-bearing here. The rule does not ask "is there a question", it asks "is there
6
- * a question FOR SOMETHING THAT HAS ALREADY SHIPPED". Remove the stage gate and the rule starts
7
- * scolding every draft in the corpus, and gets turned off within a week. So "silent on a draft"
8
- * is checked by its own assert, not treated as a special case of "silent".
9
- *
10
- * Language is the second forgotten half: a paper in this corpus can be either LaTeX or markdown.
11
- * A rule pinned to `.tex` only would LOSE `compile-rules-2026`, where the paper is written in
12
- * markdown and states no question — one of the two real findings on the live corpus.
13
- */
14
- import assert from "node:assert/strict";
15
- import { join, dirname } from "node:path";
16
- import {
17
- mkdirSync,
18
- mkdtempSync,
19
- readFileSync,
20
- realpathSync,
21
- rmSync,
22
- writeFileSync,
23
- } from "node:fs";
24
- import { tmpdir } from "node:os";
25
- import { fileURLToPath } from "node:url";
26
- import { Linter } from "eslint";
27
- import markdown from "@eslint/markdown";
28
- import { createChecker } from "../lib/check.ts";
29
-
30
- const HERE = dirname(fileURLToPath(import.meta.url));
31
- const FIX = join(HERE, "..", "fixtures", "paper-research-question");
32
-
33
- const { texLanguage } = await import(join(HERE, "latex-language.ts"));
34
- const rq = (await import(join(HERE, "paper-research-question.ts"))).default;
35
-
36
- const check = createChecker();
37
-
38
- const linter = new Linter();
39
-
40
- /** Run against one fixture. The language is picked by extension — exactly like the consumer's config. */
41
- function lint(dir, file, opts = {}) {
42
- const path = join(FIX, dir, file);
43
- const tex = file.endsWith(".tex");
44
- const cfg = tex
45
- ? {
46
- files: ["**/*.tex"],
47
- plugins: { tex: { languages: { latex: texLanguage } }, paper: rq },
48
- language: "tex/latex",
49
- }
50
- : {
51
- // `files` is required, not cosmetic: without it flat config falls back to JS
52
- // extensions, and the fixture comes back as "No matching configuration found" — a
53
- // message that reads exactly like a clean run.
54
- files: ["**/*.md"],
55
- plugins: { markdown, paper: rq },
56
- language: "markdown/gfm",
57
- languageOptions: { frontmatter: "yaml" },
58
- };
59
- const msgs = linter.verify(
60
- readFileSync(path, "utf-8"),
61
- [{ ...cfg, rules: { "paper/research-question": ["error", opts] } }],
62
- path,
63
- );
64
- assert.deepEqual(
65
- msgs.filter((m) => m.fatal),
66
- [],
67
- `${dir}/${file}: the rule threw`,
68
- );
69
- return msgs.map((m) => m.message);
70
- }
71
-
72
- // ── fires on a planted defect ───────────────────────────────────────────────────────────
73
- const fires = lint("shipped-no-rq", "paper.tex");
74
- check("shipped and no question — a finding", fires.length === 1);
75
- // 🔴 The message must name WHERE the requirement comes from. Without this it reads as the
76
- // linter's taste, but the requirement came from a real venue reviewer.
77
- check(
78
- "and it cites the reviewer, rather than passing this off as the linter's taste",
79
- /reviewer/i.test(fires[0]),
80
- );
81
- // The stages in the text come from the FIELD. The predecessor derived them with a regex over
82
- // the scorecard's prose and on agenticdev printed `submitted` where `submitted, camera-ready`
83
- // was declared.
84
- check(
85
- "the stage list in the message comes from the field and carries BOTH",
86
- /submitted\/camera-ready/.test(fires[0]),
87
- );
88
-
89
- // markdown — the second half of LANGUAGE, without it one of the two real findings is lost
90
- check(
91
- "a paper in markdown is checked the same way",
92
- lint("markdown-no-rq", "paper.md").length === 1,
93
- );
94
-
95
- // ── THE CASE THE PREDECESSOR COULD NOT EXPRESS ──────────────────────────────────────────
96
- // 🔴 The point of the 2026-09-19 redesign, in one fixture. The scorecard declares a question,
97
- // the paper does not carry it — AND the paper contains the words "research question", inside
98
- // "We leave the research question to future work". The old pattern matched that phrase and went
99
- // SILENT on a paper stating no question at all. Matching a sentence ABOUT the thing is not
100
- // finding the thing, and no list of spellings fixes that.
101
- const drifted = lint("declared-not-in-paper", "paper.tex");
102
- check(
103
- "declared but absent from the paper — a finding, where the old pattern was silent",
104
- drifted.length === 1,
105
- );
106
- check(
107
- "and the message QUOTES what was looked for, so the author can see why it missed",
108
- /does pruning reduce review cost\?/i.test(drifted[0]),
109
- );
110
-
111
- // ── stays silent where it must ──────────────────────────────────────────────────────────
112
- check(
113
- "the question is stated — silent",
114
- lint("shipped-with-rq", "paper.tex").length === 0,
115
- );
116
- // The stage gate: a draft owes nothing, because it never asked anyone to read it.
117
- check(
118
- "a draft (no stages) — silent, even though it has no question either",
119
- lint("draft", "paper.tex").length === 0,
120
- );
121
- // And the distinguisher against the previous case: the same draft with a SWAPPED scorecard
122
- // name is also silent — so the silence there is not because the file went unfound, it's
123
- // because the stage list is empty.
124
- check(
125
- "and with a nonexistent scorecard a shipped paper is also silent — the stage gate is load-bearing",
126
- lint("shipped-no-rq", "paper.tex", { statusFile: "NO-SUCH-FILE.md" })
127
- .length === 0,
128
- );
129
-
130
- // ── a named hole, pinned down by an assert, and RESHAPED by the redesign ────────────────
131
- // ⚠️ The hole changed form on 2026-09-19 and did not close. Before, ANY mention of "RQ" in a
132
- // LaTeX comment silenced the rule. Now the rule no longer hunts for spellings, so this fixture
133
- // — a comment saying "TODO: state the research question", with no `researchQuestion` field —
134
- // is a FINDING, which it never was before. What survives is narrower: if the DECLARED sentence
135
- // appears only inside a comment, the raw-text comparison still accepts it. That is a smaller
136
- // hole with a named owner, and closing it means walking the parsed tree.
137
- check(
138
- "a paper whose only mention is a comment, with nothing declared, is now a finding",
139
- lint("comment-only", "paper.tex").length === 1,
140
- );
141
-
142
- // ── the scorecard's name is consumer data ───────────────────────────────────────────────
143
- check(
144
- "the scorecard's name comes in as an option",
145
- lint("shipped-no-rq", "paper.tex", { statusFile: "PIPELINE-STATUS.md" })
146
- .length === 1,
147
- );
148
-
149
- // ── a scorecard that cannot be read is no scorecard: silence, never a crash ────────────
150
- // A directory where the file should be (EISDIR), and front matter that is not YAML — which
151
- // `paper/stages` reports on the scorecard itself, so this rule does not report it twice.
152
- {
153
- const work = realpathSync(mkdtempSync(join(tmpdir(), "paperlint-rq-")));
154
- try {
155
- const paperIn = (name, status) => {
156
- const dir = join(work, name);
157
- mkdirSync(dir);
158
- status(join(dir, "PIPELINE-STATUS.md"));
159
- const path = join(dir, "paper.md");
160
- writeFileSync(path, "# A paper\n");
161
- // A linter rooted at the scratch directory: files outside `cwd` match no config.
162
- return new Linter({ cwd: work }).verify(
163
- "# A paper\n",
164
- [
165
- {
166
- files: ["**/*.md"],
167
- plugins: { markdown, paper: rq },
168
- language: "markdown/gfm",
169
- rules: { "paper/research-question": "error" },
170
- },
171
- ],
172
- path,
173
- );
174
- };
175
- check(
176
- "a scorecard path that is a directory: no finding, no crash",
177
- JSON.stringify(paperIn("dir", (p) => mkdirSync(p))) === "[]",
178
- () => paperIn("dir2", (p) => mkdirSync(p)),
179
- );
180
- check(
181
- "a scorecard whose front matter is not YAML: no finding, no crash",
182
- JSON.stringify(
183
- paperIn("yaml", (p) =>
184
- writeFileSync(p, "---\nstages: [submitted\n---\n"),
185
- ),
186
- ) === "[]",
187
- );
188
- } finally {
189
- rmSync(work, { recursive: true, force: true });
190
- }
191
- }
192
-
193
- // ── a language whose source code carries no text at all: nothing to compare, silence ───
194
- {
195
- const reports = [];
196
- rq.rules["research-question"]
197
- .create({
198
- options: [],
199
- filename: join(FIX, "shipped-no-rq", "paper.tex"),
200
- sourceCode: {},
201
- report: (r) => reports.push(r),
202
- })
203
- ["root:exit"]({});
204
- check(
205
- "a source code with neither `raw` nor `text` is skipped, even for a shipped paper",
206
- reports.length === 0,
207
- );
208
- }
209
-
210
- console.log(
211
- `✓ ${String(check.count)} assertions passed — paper/research-question, the debt of a shipped paper`,
212
- );