paperlint 18.1.0 → 18.2.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.
- package/README.md +2 -2
- package/dist/adapters/latex/document-class.d.ts +28 -5
- package/dist/adapters/latex/document-class.d.ts.map +1 -1
- package/dist/adapters/latex/document-class.js +208 -21
- package/dist/adapters/latex/document-class.js.map +1 -1
- package/dist/adapters/latex/index.d.ts +4 -4
- package/dist/adapters/latex/index.d.ts.map +1 -1
- package/dist/adapters/latex/index.js +5 -2
- package/dist/adapters/latex/index.js.map +1 -1
- package/dist/adapters/latex/parse.d.ts.map +1 -1
- package/dist/adapters/latex/parse.js +5 -0
- package/dist/adapters/latex/parse.js.map +1 -1
- package/dist/domain/body-pages.d.ts.map +1 -1
- package/dist/domain/body-pages.js +4 -2
- package/dist/domain/body-pages.js.map +1 -1
- package/dist/domain/tex-document.d.ts +52 -4
- package/dist/domain/tex-document.d.ts.map +1 -1
- package/dist/domain/tex-document.js +9 -0
- package/dist/domain/tex-document.js.map +1 -1
- package/dist/eslint-rules/latex-language.d.ts +10 -0
- package/dist/eslint-rules/latex-language.d.ts.map +1 -1
- package/dist/eslint-rules/latex-language.js +41 -2
- package/dist/eslint-rules/latex-language.js.map +1 -1
- package/dist/ports/latex.d.ts +13 -1
- package/dist/ports/latex.d.ts.map +1 -1
- package/dist/presets.d.ts +15 -0
- package/dist/presets.d.ts.map +1 -1
- package/dist/presets.js +9 -0
- package/dist/presets.js.map +1 -1
- package/dist/tex-requirements.d.ts +2 -0
- package/dist/tex-requirements.d.ts.map +1 -1
- package/dist/tex-requirements.js +7 -2
- package/dist/tex-requirements.js.map +1 -1
- package/dist/tex-venue-rules.d.ts +36 -3
- package/dist/tex-venue-rules.d.ts.map +1 -1
- package/dist/tex-venue-rules.js +181 -33
- package/dist/tex-venue-rules.js.map +1 -1
- package/docs/rules/cycle/port-done.md +3 -0
- package/docs/rules/tex/template.md +96 -1
- package/docs/rules.md +18 -13
- package/docs/venues.md +51 -12
- package/eslint-rules/latex-language.test.mjs +64 -1
- package/eslint-rules/latex-language.ts +44 -2
- package/eslint.config.mjs +1 -0
- package/fixtures/build-e2e/neurips/PIPELINE-STATUS.md +3 -0
- package/fixtures/build-e2e/neurips/expect.json +20 -0
- package/fixtures/build-e2e/neurips/paper.tex +60 -0
- package/fixtures/build-e2e/neurips/paperlint.json +1 -0
- package/fixtures/build-e2e/neurips-nostyle/PIPELINE-STATUS.md +3 -0
- package/fixtures/build-e2e/neurips-nostyle/expect.json +26 -0
- package/fixtures/build-e2e/neurips-nostyle/paper.tex +56 -0
- package/fixtures/build-e2e/neurips-nostyle/paperlint.json +1 -0
- package/fixtures/build-e2e/neurips-over/PIPELINE-STATUS.md +3 -0
- package/fixtures/build-e2e/neurips-over/expect.json +24 -0
- package/fixtures/build-e2e/neurips-over/paper.tex +56 -0
- package/fixtures/build-e2e/neurips-over/paperlint.json +1 -0
- package/fixtures/real-papers.test.ts +17 -6
- package/package.json +3 -1
- package/presets/aaai-2027.jsonc +126 -0
- package/presets/aaai-2027.md +127 -0
- package/presets/aaai-press.jsonc +167 -0
- package/presets/aaai-press.md +126 -0
- package/presets/icml-2027.jsonc +111 -0
- package/presets/icml-2027.md +130 -0
- package/presets/icml-style.jsonc +125 -0
- package/presets/icml-style.md +77 -0
- package/presets/neurips-2026.jsonc +123 -0
- package/presets/neurips-2026.md +137 -0
- package/presets/neurips-style.jsonc +113 -0
- package/presets/neurips-style.md +85 -0
- package/presets/venue-profile.schema.json +6 -0
- package/skills/build-label-page/scripts/label-page-browser.test.ts +275 -114
- package/src/adapters/latex/document-class.ts +292 -20
- package/src/adapters/latex/index.test.ts +263 -0
- package/src/adapters/latex/index.ts +12 -3
- package/src/adapters/latex/parse.ts +5 -0
- package/src/cli.test.ts +6 -1
- package/src/domain/body-pages.test.ts +22 -6
- package/src/domain/body-pages.ts +4 -2
- package/src/domain/tex-document.ts +64 -5
- package/src/folder-venue-rule.test.ts +51 -0
- package/src/new-paper.test.ts +2 -2
- package/src/paper-settings-commands.test.ts +1 -1
- package/src/ports/latex.ts +14 -0
- package/src/preset-card-rule.test.ts +44 -27
- package/src/presets.test.ts +177 -1
- package/src/presets.ts +27 -0
- package/src/rule-cases.test.ts +52 -0
- package/src/tex-requirements.harness.ts +17 -3
- package/src/tex-requirements.ts +13 -2
- package/src/tex-venue-rules.test.ts +1020 -0
- package/src/tex-venue-rules.ts +248 -38
- package/src/venue-rules.test.ts +369 -2
|
@@ -15,16 +15,19 @@
|
|
|
15
15
|
* the parser the language already uses.
|
|
16
16
|
*
|
|
17
17
|
* ── STATES, NOT NULL ─────────────────────────────────────────────────────────────
|
|
18
|
-
* A class line is missing, empty or a class; a node the parser gave no position is
|
|
19
|
-
* offset 0; a run of text is a non-empty list of contiguous segments, and a range
|
|
20
|
-
* no span (`spanIn` in `src/domain/tex-document.ts`). A tree travels only with its own source
|
|
18
|
+
* A class line is missing, unseen, empty, unread or a class; a node the parser gave no position is
|
|
19
|
+
* `unplaced`, not offset 0; a run of text is a non-empty list of contiguous segments, and a range
|
|
20
|
+
* outside it has no span (`spanIn` in `src/domain/tex-document.ts`). A tree travels only with its own source
|
|
21
21
|
* (`ParsedTex`, minted by `parseLatex` alone).
|
|
22
22
|
*/
|
|
23
23
|
import type { LatexReader } from "../../ports/latex.ts";
|
|
24
24
|
import { abstractSpan, abstractText } from "./abstract.ts";
|
|
25
25
|
import {
|
|
26
26
|
documentClassOf,
|
|
27
|
+
packagesOf,
|
|
28
|
+
packagesUnseen,
|
|
27
29
|
parseTemplate,
|
|
30
|
+
parseTemplateStyle,
|
|
28
31
|
replaceDocumentClass,
|
|
29
32
|
} from "./document-class.ts";
|
|
30
33
|
import { citeKeysOf, macroTextsOf, registeredNumbersOf } from "./facts.ts";
|
|
@@ -41,7 +44,10 @@ import { filecontentsOf } from "./filecontents.ts";
|
|
|
41
44
|
|
|
42
45
|
export {
|
|
43
46
|
documentClassOf,
|
|
47
|
+
packagesOf,
|
|
48
|
+
packagesUnseen,
|
|
44
49
|
parseTemplate,
|
|
50
|
+
parseTemplateStyle,
|
|
45
51
|
replaceDocumentClass,
|
|
46
52
|
} from "./document-class.ts";
|
|
47
53
|
export {
|
|
@@ -76,6 +82,9 @@ export const latexReader: LatexReader = {
|
|
|
76
82
|
includes: (src) => includesOf(parseLatex(src)),
|
|
77
83
|
documentBody: (src) => documentBodyOf(parseLatex(src)),
|
|
78
84
|
template: parseTemplate,
|
|
85
|
+
packages: (src) => packagesOf(parseLatex(src)),
|
|
86
|
+
packagesUnseen: (src) => packagesUnseen(parseLatex(src)),
|
|
87
|
+
templateStyle: parseTemplateStyle,
|
|
79
88
|
withDocumentClass: (src, want) => replaceDocumentClass(parseLatex(src), want),
|
|
80
89
|
layoutOverrides: (src) => layoutOverridesOf(parseLatex(src)),
|
|
81
90
|
filecontents: (src, jobname) => filecontentsOf(parseLatex(src), jobname),
|
|
@@ -107,6 +107,11 @@ export const KEY_SIGNATURES: Readonly<
|
|
|
107
107
|
...signed(["nobibliography"], "m"),
|
|
108
108
|
...signed(["includegraphics"], "s o o m"),
|
|
109
109
|
...signed(["usepackage", "RequirePackage", "documentclass"], "o m o"),
|
|
110
|
+
// Options for a class, given before its `\documentclass`: `tex/template` reads them as the line's.
|
|
111
|
+
// The same for a package, before its `\usepackage`.
|
|
112
|
+
...signed(["PassOptionsToClass", "PassOptionsToPackage"], "m m"),
|
|
113
|
+
// A package given the options of the file that loads it: `\RequirePackageWithOptions{pkg}[date]`.
|
|
114
|
+
...signed(["RequirePackageWithOptions"], "m o"),
|
|
110
115
|
]);
|
|
111
116
|
|
|
112
117
|
/**
|
package/src/cli.test.ts
CHANGED
|
@@ -34,7 +34,11 @@ import { texInputsDir } from "./package-dirs.ts";
|
|
|
34
34
|
|
|
35
35
|
const root = useTempDir("cli-test-");
|
|
36
36
|
|
|
37
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* `run(argv)` from `cwd`, the output as one string per stream. Its clock stands still, so `lint`'s
|
|
39
|
+
* «linted N file(s) in 0.0 s» is the same however long the run took: under a loaded
|
|
40
|
+
* `npm run test:changed` two lints of one tree printed 0.2 s and 0.0 s.
|
|
41
|
+
*/
|
|
38
42
|
async function cli(
|
|
39
43
|
argv: string[],
|
|
40
44
|
cwd: string,
|
|
@@ -46,6 +50,7 @@ async function cli(
|
|
|
46
50
|
log: (...a: unknown[]) => out.push(a.join(" ")),
|
|
47
51
|
err: (...a: unknown[]) => err.push(a.join(" ")),
|
|
48
52
|
cwd,
|
|
53
|
+
now: () => 0,
|
|
49
54
|
...deps,
|
|
50
55
|
});
|
|
51
56
|
return { code, out: out.join("\n"), err: err.join("\n") };
|
|
@@ -16,19 +16,35 @@ describe("isReferencesHeading", () => {
|
|
|
16
16
|
"7 References",
|
|
17
17
|
"VII. REFERENCES",
|
|
18
18
|
" References ",
|
|
19
|
+
// lineno's line number, which pdf.js reads glued to the end of the line (a NeurIPS submission,
|
|
20
|
+
// measured 2026-11-19 on fixtures/build-e2e/neurips: «References346»).
|
|
21
|
+
"References346",
|
|
22
|
+
"7 References 12",
|
|
19
23
|
])("%j is a heading", (line) => {
|
|
20
24
|
expect(isReferencesHeading(line)).toBe(true);
|
|
21
25
|
});
|
|
22
26
|
|
|
23
|
-
it.each([
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
it.each([
|
|
28
|
+
"See the references below",
|
|
29
|
+
"References to prior work",
|
|
30
|
+
"References to prior work 346",
|
|
31
|
+
"Refs",
|
|
32
|
+
"",
|
|
33
|
+
])("%j is not", (line) => {
|
|
34
|
+
expect(isReferencesHeading(line)).toBe(false);
|
|
35
|
+
});
|
|
29
36
|
});
|
|
30
37
|
|
|
31
38
|
describe("bodyEnd", () => {
|
|
39
|
+
it("🔴 a line-numbered submission: the heading with its line number still ends the body", () => {
|
|
40
|
+
expect(
|
|
41
|
+
bodyEnd([
|
|
42
|
+
"Intro1\nbody2",
|
|
43
|
+
"end of the body345\nReferences346\n[1] A.347",
|
|
44
|
+
]),
|
|
45
|
+
).toEqual({ kind: "found", by: "references", page: 2, bodyPages: 2 });
|
|
46
|
+
});
|
|
47
|
+
|
|
32
48
|
it("a heading below body text on its page: that page is a body page", () => {
|
|
33
49
|
expect(
|
|
34
50
|
bodyEnd([
|
package/src/domain/body-pages.ts
CHANGED
|
@@ -65,9 +65,11 @@ export type BodyEnd =
|
|
|
65
65
|
/**
|
|
66
66
|
* A line that is a references heading: `References` or `Bibliography`, in any case (IEEEtran sets
|
|
67
67
|
* `REFERENCES` in small caps, which pdf.js may split as `R EFERENCES`), optionally numbered
|
|
68
|
-
* (`7 References`, `VII. REFERENCES`)
|
|
68
|
+
* (`7 References`, `VII. REFERENCES`), and with the line number `lineno` sets in a submission's
|
|
69
|
+
* margin, which pdf.js reads glued to the end of the line (`References346`). The line is compared
|
|
70
|
+
* with every space removed.
|
|
69
71
|
*/
|
|
70
|
-
const HEADING = /^(?:(?:\d+|[ivxlcdm]+)\.?)?(?:references|bibliography)
|
|
72
|
+
const HEADING = /^(?:(?:\d+|[ivxlcdm]+)\.?)?(?:references|bibliography)\d*$/iu;
|
|
71
73
|
|
|
72
74
|
/** Whether one line of a page's text is the references heading. */
|
|
73
75
|
export const isReferencesHeading = (line: string): boolean =>
|
|
@@ -24,18 +24,56 @@ export interface DocumentClass {
|
|
|
24
24
|
readonly options: readonly string[];
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Options given to a class before its line, by `\PassOptionsToClass{options}{class}`: in effect as
|
|
29
|
+
* if the line carried them. Each option as written; `unread` holds the ones built by a macro.
|
|
30
|
+
*/
|
|
31
|
+
export interface PassedOptions {
|
|
32
|
+
readonly options: readonly string[];
|
|
33
|
+
readonly unread: readonly string[];
|
|
34
|
+
readonly place: Place;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* One `\documentclass` line: one that names no class; one whose class is built by a macro
|
|
39
|
+
* (`\documentclass{\cls}`), which no macro is expanded to read; or a class with each option as
|
|
40
|
+
* written. Of those options, `unread` holds the ones built by a macro (`[\opts]`): what they carry
|
|
41
|
+
* is not known. `passed` are the options `\PassOptionsToClass` gave this class before the line.
|
|
42
|
+
*/
|
|
28
43
|
export type ClassCandidate =
|
|
29
44
|
| { readonly kind: "empty"; readonly place: Place }
|
|
30
|
-
|
|
|
45
|
+
| { readonly kind: "unread"; readonly place: Place }
|
|
46
|
+
| ({
|
|
47
|
+
readonly kind: "class";
|
|
48
|
+
readonly place: Place;
|
|
49
|
+
readonly unread: readonly string[];
|
|
50
|
+
readonly passed: readonly PassedOptions[];
|
|
51
|
+
} & DocumentClass);
|
|
52
|
+
|
|
53
|
+
/** Every option a class line puts in effect: its own, then the ones passed to its class before it. */
|
|
54
|
+
export const optionsInEffect = (
|
|
55
|
+
line: Extract<ClassCandidate, { readonly kind: "class" }>,
|
|
56
|
+
): DocumentClass => ({
|
|
57
|
+
cls: line.cls,
|
|
58
|
+
options: [...line.options, ...line.passed.flatMap((p) => p.options)],
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
/** Whether every option a class line puts in effect was read: none is built by a macro. */
|
|
62
|
+
export const readWhole = (
|
|
63
|
+
line: Extract<ClassCandidate, { readonly kind: "class" }>,
|
|
64
|
+
): boolean =>
|
|
65
|
+
line.unread.length === 0 && line.passed.every((p) => p.unread.length === 0);
|
|
31
66
|
|
|
32
67
|
/**
|
|
33
|
-
* A paper's `\documentclass`: none
|
|
34
|
-
*
|
|
35
|
-
*
|
|
68
|
+
* A paper's `\documentclass`: none; none the reader can see, though one may stand where it does not
|
|
69
|
+
* look (`unseen`: inside another macro's argument, or in a file the preamble `\input`s that was not
|
|
70
|
+
* read); exactly one; or several — a source that picks its class behind a TeX switch
|
|
71
|
+
* (`\if\venue1 \documentclass{article} \fi …`). Which branch builds is not evaluated, so several
|
|
72
|
+
* lines are candidates, in source order, and none of them is THE class.
|
|
36
73
|
*/
|
|
37
74
|
export type ClassLine =
|
|
38
75
|
| { readonly kind: "missing" }
|
|
76
|
+
| { readonly kind: "unseen" }
|
|
39
77
|
| ClassCandidate
|
|
40
78
|
| {
|
|
41
79
|
readonly kind: "ambiguous";
|
|
@@ -78,6 +116,27 @@ export function venueClass(
|
|
|
78
116
|
export const documentClassLine = (d: DocumentClass): string =>
|
|
79
117
|
`\\documentclass${d.options.length > 0 ? `[${d.options.join(",")}]` : ""}{${d.cls}}`;
|
|
80
118
|
|
|
119
|
+
/** A style package as a template names it: the package and the options it requires. */
|
|
120
|
+
export interface StylePackage {
|
|
121
|
+
readonly name: string;
|
|
122
|
+
readonly options: readonly string[];
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* One package a `\usepackage`, `\RequirePackage` or `\RequirePackageWithOptions` of the paper
|
|
127
|
+
* loads, with every option LaTeX hands it, as written (whitespace collapsed): the class line's, those
|
|
128
|
+
* passed to it before the load, the load's own. Of those, `unread` holds the ones built by a macro,
|
|
129
|
+
* whose content is not known. A line loading several packages (`\usepackage{a,b}`) gives one each.
|
|
130
|
+
*/
|
|
131
|
+
export interface PackageLoad extends StylePackage {
|
|
132
|
+
readonly unread: readonly string[];
|
|
133
|
+
readonly place: Place;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** A style package as a `\usepackage` line, for a message. */
|
|
137
|
+
export const usepackageLine = (s: StylePackage): string =>
|
|
138
|
+
`\\usepackage${s.options.length > 0 ? `[${s.options.join(",")}]` : ""}{${s.name}}`;
|
|
139
|
+
|
|
81
140
|
/** One `\section` or `\section*`, its title's text with whitespace collapsed. */
|
|
82
141
|
export interface Heading {
|
|
83
142
|
readonly title: string;
|
|
@@ -159,6 +159,57 @@ describe("paper/folder-venue-leftover — a venue is named by its edition", () =
|
|
|
159
159
|
});
|
|
160
160
|
});
|
|
161
161
|
|
|
162
|
+
describe("paper/folder-venue-leftover — NeurIPS, named by its edition", () => {
|
|
163
|
+
it("🔴 «neurips-2026-…» is reported in another venue's paper; «neurips-…» without the year is not, nor under neurips-2026", () => {
|
|
164
|
+
expect(
|
|
165
|
+
lint("neurips-2026-diffusion", AIDC).map(
|
|
166
|
+
(r) => /names the venue (.*?), and/u.exec(r.message)?.[1],
|
|
167
|
+
),
|
|
168
|
+
).toEqual(["NeurIPS 2026"]);
|
|
169
|
+
expect(lint("neurips-diffusion", AIDC)).toEqual([]);
|
|
170
|
+
expect(
|
|
171
|
+
lint("neurips-2026-diffusion", {
|
|
172
|
+
extends: "paperlint:neurips-2026",
|
|
173
|
+
kind: "main",
|
|
174
|
+
}),
|
|
175
|
+
).toEqual([]);
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
describe("paper/folder-venue-leftover — AAAI, named by its edition", () => {
|
|
180
|
+
it("🔴 «aaai-2027-…» is reported in another venue's paper; «aaai-…» without the year is not, nor under aaai-2027", () => {
|
|
181
|
+
expect(
|
|
182
|
+
lint("aaai-2027-planning", AIDC).map(
|
|
183
|
+
(r) => /names the venue (.*?), and/u.exec(r.message)?.[1],
|
|
184
|
+
),
|
|
185
|
+
).toEqual(["AAAI 2027"]);
|
|
186
|
+
expect(lint("aaai-planning", AIDC)).toEqual([]);
|
|
187
|
+
expect(
|
|
188
|
+
lint("aaai-2027-planning", {
|
|
189
|
+
extends: "paperlint:aaai-2027",
|
|
190
|
+
kind: "main",
|
|
191
|
+
}),
|
|
192
|
+
).toEqual([]);
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
describe("paper/folder-venue-leftover — ICML, named by its edition", () => {
|
|
197
|
+
it("🔴 «icml-2027-…» is reported in another venue's paper; «icml-…» without the year is not, nor under icml-2027", () => {
|
|
198
|
+
expect(
|
|
199
|
+
lint("icml-2027-diffusion", AIDC).map(
|
|
200
|
+
(r) => /names the venue (.*?), and/u.exec(r.message)?.[1],
|
|
201
|
+
),
|
|
202
|
+
).toEqual(["ICML 2027"]);
|
|
203
|
+
expect(lint("icml-diffusion", AIDC)).toEqual([]);
|
|
204
|
+
expect(
|
|
205
|
+
lint("icml-2027-diffusion", {
|
|
206
|
+
extends: "paperlint:icml-2027",
|
|
207
|
+
kind: "main",
|
|
208
|
+
}),
|
|
209
|
+
).toEqual([]);
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
|
|
162
213
|
describe("paper/folder-venue-leftover — a workshop's parent conference", () => {
|
|
163
214
|
it("🔴 in another venue's paper it is reported once, as itself", () => {
|
|
164
215
|
const named = (folder: string) =>
|
package/src/new-paper.test.ts
CHANGED
|
@@ -297,11 +297,11 @@ describe("paperlint new --venue msr", () => {
|
|
|
297
297
|
|
|
298
298
|
describe("paperlint new --venue — a venue it cannot use", () => {
|
|
299
299
|
it("an unknown venue exits 2, lists the shipped presets, and creates nothing", async () => {
|
|
300
|
-
const r = await newIn(["--venue", "
|
|
300
|
+
const r = await newIn(["--venue", "usenix"]);
|
|
301
301
|
expect(r.code).toBe(2);
|
|
302
302
|
// Guards: the list is read from the shipped presets, the same list lint prints.
|
|
303
303
|
expect(r.err).toContain(shippedPresets(presetsDir()).join(", "));
|
|
304
|
-
expect(r.err).toMatch(/--venue
|
|
304
|
+
expect(r.err).toMatch(/--venue usenix: no such venue preset/);
|
|
305
305
|
expect(existsSync(r.dir)).toBe(false);
|
|
306
306
|
});
|
|
307
307
|
|
|
@@ -302,7 +302,7 @@ describe("paperlint lint — the paper over its preset, and the project's own pr
|
|
|
302
302
|
const r = await lint(root);
|
|
303
303
|
expect(r.code).toBe(1);
|
|
304
304
|
expect(r.out).toMatch(
|
|
305
|
-
/acl-latex, acm-acmsmall, acm-sigconf, acsac-2026, agent-2027, agenticdev-2026, agentverify-2027, aidc-2026, aisec-2026, ase-2026, ccs-2026, emnlp-2026, fse-2027, icse-2027, icse-2028, ieee-conference, msr-2027, nlbse-2027, realm-2026, sp-2027/,
|
|
305
|
+
/aaai-2027, aaai-press, acl-latex, acm-acmsmall, acm-sigconf, acsac-2026, agent-2027, agenticdev-2026, agentverify-2027, aidc-2026, aisec-2026, ase-2026, ccs-2026, emnlp-2026, fse-2027, icml-2027, icml-style, icse-2027, icse-2028, ieee-conference, msr-2027, neurips-2026, neurips-style, nlbse-2027, realm-2026, sp-2027/,
|
|
306
306
|
);
|
|
307
307
|
});
|
|
308
308
|
});
|
package/src/ports/latex.ts
CHANGED
|
@@ -11,6 +11,8 @@ import type {
|
|
|
11
11
|
Emphasis,
|
|
12
12
|
LayoutOverride,
|
|
13
13
|
Outline,
|
|
14
|
+
PackageLoad,
|
|
15
|
+
StylePackage,
|
|
14
16
|
Passage,
|
|
15
17
|
Place,
|
|
16
18
|
Span,
|
|
@@ -89,6 +91,18 @@ export interface LatexReader {
|
|
|
89
91
|
* class name (no option). Null for anything else.
|
|
90
92
|
*/
|
|
91
93
|
readonly template: (text: string) => DocumentClass | null;
|
|
94
|
+
/** Every package the preamble's `\usepackage` and `\RequirePackage` lines load, in source order. */
|
|
95
|
+
readonly packages: (src: string) => readonly PackageLoad[];
|
|
96
|
+
/**
|
|
97
|
+
* Whether the preamble may load a package `packages` does not see: an unread `\input`, a package
|
|
98
|
+
* line inside a macro, or one whose name a macro builds.
|
|
99
|
+
*/
|
|
100
|
+
readonly packagesUnseen: (src: string) => boolean;
|
|
101
|
+
/**
|
|
102
|
+
* A preset's `template_style` → the package it names and the options it requires: one whole
|
|
103
|
+
* `\usepackage[…]{…}` line naming one package. Null for anything else.
|
|
104
|
+
*/
|
|
105
|
+
readonly templateStyle: (text: string) => StylePackage | null;
|
|
92
106
|
/**
|
|
93
107
|
* `src` with its `\documentclass` set to `want` — unless it already is `want`'s class with every
|
|
94
108
|
* option `want` names (the author's own options stay), or it has none.
|
|
@@ -81,37 +81,54 @@ const sectionOf = (text: string): string =>
|
|
|
81
81
|
const STALE =
|
|
82
82
|
"preset/card-rules: the rules section does not match the preset beside this card — run `npx eslint --fix` on this file to rewrite it from the preset";
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
/**
|
|
85
|
+
* The first test lints every card in presets/, and that grows with each venue. Measured in CI's
|
|
86
|
+
* coverage job with 19 cards: 2.0 s and 3.5 s (run 44507805064, attempts 1 and 2); 1.4 s here with
|
|
87
|
+
* 17. At that rate it passes vitest's 5 s default at about 27 cards; 21 cards took 5.0 s under
|
|
88
|
+
* `npm run test:changed` (2026-11-19), past vitest's default.
|
|
89
|
+
*/
|
|
90
|
+
const ALL_CARDS_MS = 30_000;
|
|
91
|
+
|
|
92
|
+
/** Every card in presets/, by file name: a new preset adds its card here. */
|
|
93
|
+
const SHIPPED_CARDS = [
|
|
94
|
+
"aaai-2027.md",
|
|
95
|
+
"aaai-press.md",
|
|
96
|
+
"acl-latex.md",
|
|
97
|
+
"acm-acmsmall.md",
|
|
98
|
+
"acm-sigconf.md",
|
|
99
|
+
"acsac-2026.md",
|
|
100
|
+
"agent-2027.md",
|
|
101
|
+
"agenticdev-2026.md",
|
|
102
|
+
"agentverify-2027.md",
|
|
103
|
+
"aidc-2026.md",
|
|
104
|
+
"aisec-2026.md",
|
|
105
|
+
"ase-2026.md",
|
|
106
|
+
"ccs-2026.md",
|
|
107
|
+
"emnlp-2026.md",
|
|
108
|
+
"fse-2027.md",
|
|
109
|
+
"icml-2027.md",
|
|
110
|
+
"icml-style.md",
|
|
111
|
+
"icse-2027.md",
|
|
112
|
+
"icse-2028.md",
|
|
113
|
+
"ieee-conference.md",
|
|
114
|
+
"msr-2027.md",
|
|
115
|
+
"neurips-2026.md",
|
|
116
|
+
"neurips-style.md",
|
|
117
|
+
"nlbse-2027.md",
|
|
118
|
+
"realm-2026.md",
|
|
119
|
+
"sp-2027.md",
|
|
120
|
+
"tex-base.md",
|
|
121
|
+
];
|
|
122
|
+
|
|
123
|
+
describe("the shipped cards", { timeout: ALL_CARDS_MS }, () => {
|
|
85
124
|
it("every shipped card holds the section its preset resolves to", async () => {
|
|
86
125
|
const results = await eslint().lintFiles([join(P, "*.md")]);
|
|
87
126
|
// Guards: a glob that matched nothing lints nothing and reports clean.
|
|
88
|
-
expect(results.map((r) => r.filePath.slice(P.length + 1)).sort()).toEqual(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"acm-sigconf.md",
|
|
92
|
-
"acsac-2026.md",
|
|
93
|
-
"agent-2027.md",
|
|
94
|
-
"agenticdev-2026.md",
|
|
95
|
-
"agentverify-2027.md",
|
|
96
|
-
"aidc-2026.md",
|
|
97
|
-
"aisec-2026.md",
|
|
98
|
-
"ase-2026.md",
|
|
99
|
-
"ccs-2026.md",
|
|
100
|
-
"emnlp-2026.md",
|
|
101
|
-
"fse-2027.md",
|
|
102
|
-
"icse-2027.md",
|
|
103
|
-
"icse-2028.md",
|
|
104
|
-
"ieee-conference.md",
|
|
105
|
-
"msr-2027.md",
|
|
106
|
-
"nlbse-2027.md",
|
|
107
|
-
"realm-2026.md",
|
|
108
|
-
"sp-2027.md",
|
|
109
|
-
"tex-base.md",
|
|
110
|
-
]);
|
|
127
|
+
expect(results.map((r) => r.filePath.slice(P.length + 1)).sort()).toEqual(
|
|
128
|
+
SHIPPED_CARDS,
|
|
129
|
+
);
|
|
111
130
|
expect(results.flatMap((r) => r.messages)).toEqual([]);
|
|
112
|
-
|
|
113
|
-
// (2026-11-19), past vitest's default of 5 s.
|
|
114
|
-
}, 20_000);
|
|
131
|
+
});
|
|
115
132
|
|
|
116
133
|
it("agenticdev: its own rules, linked to their page or to the index, and what it extends", async () => {
|
|
117
134
|
const text = readFileSync(join(P, "agenticdev-2026.md"), "utf8");
|