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.
- package/.claude-plugin/plugin.json +1 -1
- package/dist/default-levels.d.ts +5 -0
- package/dist/default-levels.d.ts.map +1 -0
- package/dist/default-levels.js +36 -0
- package/dist/default-levels.js.map +1 -0
- package/dist/domain/preset-submission-fields.d.ts +15 -0
- package/dist/domain/preset-submission-fields.d.ts.map +1 -0
- package/dist/domain/preset-submission-fields.js +25 -0
- package/dist/domain/preset-submission-fields.js.map +1 -0
- package/dist/domain/venue-scope.d.ts +29 -0
- package/dist/domain/venue-scope.d.ts.map +1 -0
- package/dist/domain/venue-scope.js +18 -0
- package/dist/domain/venue-scope.js.map +1 -0
- package/dist/folder-venue-rule.d.ts +1 -1
- package/dist/folder-venue-rule.d.ts.map +1 -1
- package/dist/folder-venue-rule.js.map +1 -1
- package/dist/preset-merge.d.ts +34 -0
- package/dist/preset-merge.d.ts.map +1 -0
- package/dist/preset-merge.js +89 -0
- package/dist/preset-merge.js.map +1 -0
- package/dist/presets.d.ts +3 -2
- package/dist/presets.d.ts.map +1 -1
- package/dist/presets.js +3 -84
- package/dist/presets.js.map +1 -1
- package/dist/tex-requirements.d.ts +4 -1
- package/dist/tex-requirements.d.ts.map +1 -1
- package/dist/tex-requirements.js +3 -20
- package/dist/tex-requirements.js.map +1 -1
- package/dist/tex-venue-rules.d.ts +4 -24
- package/dist/tex-venue-rules.d.ts.map +1 -1
- package/dist/tex-venue-rules.js +6 -84
- package/dist/tex-venue-rules.js.map +1 -1
- package/dist/venue-leftover.d.ts +50 -0
- package/dist/venue-leftover.d.ts.map +1 -0
- package/dist/venue-leftover.js +129 -0
- package/dist/venue-leftover.js.map +1 -0
- package/docs/rules/tex/venue-leftover.md +34 -3
- package/docs/rules.md +1 -1
- package/docs/venues.md +6 -4
- package/package.json +2 -1
- package/presets/acl-latex.md +1 -1
- package/presets/langcode-2027.jsonc +106 -0
- package/presets/langcode-2027.md +79 -0
- package/presets/naacl-2027.jsonc +19 -0
- package/presets/naacl-2027.md +42 -0
- package/presets/venue-profile.schema.json +22 -1
- package/scripts/eslint-file-length.mjs +5 -5
- package/scripts/release-config.test.ts +114 -0
- package/scripts/release-type.test.ts +86 -0
- package/scripts/release-type.ts +76 -0
- package/scripts/semantic-release-plugins.d.ts +20 -1
- package/src/default-levels.test.ts +43 -0
- package/src/default-levels.ts +53 -0
- package/src/domain/preset-submission-fields.ts +49 -0
- package/src/domain/venue-scope.test.ts +33 -0
- package/src/domain/venue-scope.ts +39 -0
- package/src/folder-venue-rule.ts +2 -1
- package/src/paper-settings-commands.test.ts +1 -1
- package/src/preset-card-rule.test.ts +2 -0
- package/src/preset-merge.ts +141 -0
- package/src/presets-scope.test.ts +177 -0
- package/src/presets.test.ts +17 -56
- package/src/presets.ts +5 -130
- package/src/rule-cases.test.ts +10 -3
- package/src/tex-requirements.ts +14 -45
- package/src/tex-venue-rules.test.ts +66 -154
- package/src/tex-venue-rules.ts +25 -146
- package/src/venue-leftover.test.ts +112 -0
- package/src/venue-leftover.ts +207 -0
- package/src/venue-rules.test.ts +2 -2
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `tex/venue-leftover`'s judge: where the rendered text names another shipped venue than the
|
|
3
|
+
* paper's edition. Pure; the rule module (`tex-venue-rules.ts`) reads the paper and the presets and
|
|
4
|
+
* hands them here.
|
|
5
|
+
*
|
|
6
|
+
* Where it reads (#552): the commands that state the paper's venue (`\acmConference` …) wherever
|
|
7
|
+
* they stand, and of the other prose what the rule's `body` option says. A leftover from an earlier
|
|
8
|
+
* submission sits in the front matter — the author block, the title-page footnotes, the abstract —
|
|
9
|
+
* so that is read always; the body, where related work names venues and recent years on every page,
|
|
10
|
+
* only when `body` is set. The front matter ends where the first `\section` begins; a paper with no
|
|
11
|
+
* section is all front matter.
|
|
12
|
+
*/
|
|
13
|
+
import { z } from "zod";
|
|
14
|
+
import {
|
|
15
|
+
runText,
|
|
16
|
+
spanIn,
|
|
17
|
+
type Outline,
|
|
18
|
+
type Place,
|
|
19
|
+
type Span,
|
|
20
|
+
type TextRun,
|
|
21
|
+
} from "./domain/tex-document.ts";
|
|
22
|
+
import { editionLabel } from "./domain/edition.ts";
|
|
23
|
+
import type { NamedVenue } from "./domain/venue-name.ts";
|
|
24
|
+
import type { Preset } from "./presets.ts";
|
|
25
|
+
import type { Located } from "./tex-venue-rules.ts";
|
|
26
|
+
|
|
27
|
+
/** Where the front matter ends: at the first section heading, or null when the paper has none. */
|
|
28
|
+
export function frontMatterEnd(outline: Outline): number | null {
|
|
29
|
+
const first = outline.sections[0]?.place;
|
|
30
|
+
return first?.kind === "at" ? first.span.start : null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** The rule's options as its `meta.schema` declares them to ESLint. */
|
|
34
|
+
export const LEFTOVER_SCHEMA = [
|
|
35
|
+
{
|
|
36
|
+
type: "object",
|
|
37
|
+
properties: { body: { type: "boolean" } },
|
|
38
|
+
additionalProperties: false,
|
|
39
|
+
},
|
|
40
|
+
] as const;
|
|
41
|
+
|
|
42
|
+
/** The same options, parsed: none, or `{ body }`. */
|
|
43
|
+
const LeftoverOptions = z.union([
|
|
44
|
+
z.tuple([]),
|
|
45
|
+
z.tuple([z.object({ body: z.boolean().optional() }).strict()]),
|
|
46
|
+
]);
|
|
47
|
+
|
|
48
|
+
/** Of a name found at `at` (null: the parser gave it no place): is it in a venue line, is it read. */
|
|
49
|
+
export interface LeftoverPlaces {
|
|
50
|
+
readonly inLine: (at: Span | null) => boolean;
|
|
51
|
+
readonly read: (at: Span | null) => boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The places of one paper: `lines` are its venue-stating commands; prose is read in the front
|
|
56
|
+
* matter, or anywhere when `body` is set. A name with no place is read only when everything is.
|
|
57
|
+
*/
|
|
58
|
+
export function leftoverPlaces(
|
|
59
|
+
lines: readonly Place[],
|
|
60
|
+
outline: Outline,
|
|
61
|
+
options: readonly unknown[],
|
|
62
|
+
): LeftoverPlaces {
|
|
63
|
+
const body = LeftoverOptions.parse(options)[0]?.body ?? false;
|
|
64
|
+
const end = frontMatterEnd(outline);
|
|
65
|
+
return {
|
|
66
|
+
inLine: (at) =>
|
|
67
|
+
at !== null &&
|
|
68
|
+
lines.some(
|
|
69
|
+
(l) =>
|
|
70
|
+
l.kind === "at" && l.span.start <= at.start && at.start < l.span.end,
|
|
71
|
+
),
|
|
72
|
+
read: (at) => body || end === null || (at !== null && at.start < end),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Another shipped venue as the text names it: the word for it (its `name`), every name it goes by,
|
|
78
|
+
* and its edition's year (from its id).
|
|
79
|
+
*/
|
|
80
|
+
export type OtherVenue = NamedVenue & Pick<Preset, "year" | "declaredAliases">;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* A year beside a name, right after it: `2027`, `'27` or `’27`, after spaces or none (`~` renders
|
|
84
|
+
* as a no-break space). Anchored: it is tried on the text after the name.
|
|
85
|
+
*/
|
|
86
|
+
const YEAR_AFTER = /^[\s\u00a0]*(?:(\d{4})|['’](\d{2}))(?![\p{L}\p{N}])/u;
|
|
87
|
+
|
|
88
|
+
/** The year written right after offset `end` of `text`, or null. `'27` is 2027. Pure. */
|
|
89
|
+
function yearAfter(text: string, end: number): number | null {
|
|
90
|
+
const m = YEAR_AFTER.exec(text.slice(end));
|
|
91
|
+
if (m === null) return null;
|
|
92
|
+
return m[1] !== undefined
|
|
93
|
+
? Number.parseInt(m[1], 10)
|
|
94
|
+
: 2000 + Number.parseInt(String(m[2]), 10);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** `s` as a pattern that matches it literally. */
|
|
98
|
+
const literal = (s: string): string =>
|
|
99
|
+
s.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
|
|
100
|
+
|
|
101
|
+
/** One name a match is judged by: whether it is the paper's own, and the venue it shows as. */
|
|
102
|
+
interface NameToJudge {
|
|
103
|
+
readonly name: string;
|
|
104
|
+
readonly own: boolean;
|
|
105
|
+
readonly shows: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Every name to look for, once each: every other shipped venue's, shown as that venue's `name`, and
|
|
110
|
+
* the paper's own and its parent's, which count only in another edition. Pure.
|
|
111
|
+
*/
|
|
112
|
+
function namesToJudge(
|
|
113
|
+
preset: Pick<Preset, "label" | "aliases" | "parentNames">,
|
|
114
|
+
others: readonly OtherVenue[],
|
|
115
|
+
): readonly NameToJudge[] {
|
|
116
|
+
const own = new Set([...preset.aliases, ...preset.parentNames]);
|
|
117
|
+
const shownBy = (name: string): string =>
|
|
118
|
+
others.find((o) => o.aliases.includes(name))?.label ??
|
|
119
|
+
(preset.aliases.includes(name) ? preset.label : name);
|
|
120
|
+
const all = [...new Set([...others.flatMap((o) => o.aliases), ...own])];
|
|
121
|
+
return all.map((name) => ({
|
|
122
|
+
name,
|
|
123
|
+
own: own.has(name),
|
|
124
|
+
shows: shownBy(name),
|
|
125
|
+
}));
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Whether a name at a place, with `year` beside it (null: none), names another venue than the
|
|
130
|
+
* paper's edition (of year `paperYear`). Inside a venue-identity command (`inLine`) any other
|
|
131
|
+
* venue's name counts; in prose only beside a year no older than the paper's year minus one, so
|
|
132
|
+
* related work («ICSE 2019») and a bare acronym are not leftovers. The paper's own names, and its
|
|
133
|
+
* parent's, count only beside another year: another edition of its own series. Pure.
|
|
134
|
+
*/
|
|
135
|
+
export function namesAnotherEdition(
|
|
136
|
+
n: { readonly own: boolean; readonly inLine: boolean },
|
|
137
|
+
year: number | null,
|
|
138
|
+
paperYear: number | null,
|
|
139
|
+
): boolean {
|
|
140
|
+
const recent = paperYear === null || (year !== null && year >= paperYear - 1);
|
|
141
|
+
if (n.own)
|
|
142
|
+
return (
|
|
143
|
+
year !== null &&
|
|
144
|
+
paperYear !== null &&
|
|
145
|
+
year !== paperYear &&
|
|
146
|
+
(n.inLine || recent)
|
|
147
|
+
);
|
|
148
|
+
return n.inLine || (year !== null && recent);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** A name to look for, with the pattern that finds it as a whole word. */
|
|
152
|
+
type NameMatcher = NameToJudge & { readonly re: RegExp };
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* The findings of one name in one run: each whole-word match judged with the year beside it and
|
|
156
|
+
* whether it stands in a venue-stating command (`inLine`). Pure.
|
|
157
|
+
*/
|
|
158
|
+
function matchesIn(
|
|
159
|
+
run: TextRun,
|
|
160
|
+
n: NameMatcher,
|
|
161
|
+
paper: LeftoverPlaces & {
|
|
162
|
+
readonly year: number | null;
|
|
163
|
+
readonly venue: string;
|
|
164
|
+
},
|
|
165
|
+
): readonly Located[] {
|
|
166
|
+
const { inLine, read, venue } = paper;
|
|
167
|
+
const text = runText(run);
|
|
168
|
+
return [...text.matchAll(n.re)].flatMap((m) => {
|
|
169
|
+
const at = spanIn(run, m.index, m.index + m[0].length);
|
|
170
|
+
const year = yearAfter(text, m.index + m[0].length);
|
|
171
|
+
const judged = { own: n.own, inLine: inLine(at) };
|
|
172
|
+
if (!judged.inLine && !read(at)) return [];
|
|
173
|
+
if (!namesAnotherEdition(judged, year, paper.year)) return [];
|
|
174
|
+
const other = editionLabel(n.shows, year);
|
|
175
|
+
return [{ messageId: "leftover", data: { name: m[0], other, venue }, at }];
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Each place the rendered text names another venue than the paper's edition — a name as a whole
|
|
181
|
+
* word, case and all, judged with the year beside it (`namesAnotherEdition`), in the `places` the
|
|
182
|
+
* rule reads (`leftoverPlaces`). A family preset names no venue, so nothing is another venue:
|
|
183
|
+
* silent.
|
|
184
|
+
*/
|
|
185
|
+
export function judgeLeftover(
|
|
186
|
+
runs: readonly TextRun[],
|
|
187
|
+
preset: Preset,
|
|
188
|
+
others: readonly OtherVenue[],
|
|
189
|
+
places: LeftoverPlaces,
|
|
190
|
+
): readonly Located[] {
|
|
191
|
+
if (preset.identity.type !== "venue") return [];
|
|
192
|
+
const venue = editionLabel(preset.label, preset.year);
|
|
193
|
+
const names: readonly NameMatcher[] = namesToJudge(preset, others).map(
|
|
194
|
+
(n) => ({
|
|
195
|
+
...n,
|
|
196
|
+
re: new RegExp(
|
|
197
|
+
`(?<![\\p{L}\\p{N}])${literal(n.name)}(?![\\p{L}\\p{N}])`,
|
|
198
|
+
"gu",
|
|
199
|
+
),
|
|
200
|
+
}),
|
|
201
|
+
);
|
|
202
|
+
return runs.flatMap((run) =>
|
|
203
|
+
names.flatMap((n) =>
|
|
204
|
+
matchesIn(run, n, { ...places, year: preset.year, venue }),
|
|
205
|
+
),
|
|
206
|
+
);
|
|
207
|
+
}
|
package/src/venue-rules.test.ts
CHANGED
|
@@ -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
|
-
/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/,
|
|
274
|
+
/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, langcode-2027, msr-2027, naacl-2027, neurips-2026, neurips-style, nlbse-2027, realm-2026, sp-2027/,
|
|
275
275
|
],
|
|
276
276
|
[
|
|
277
277
|
"the base TeX set is not a venue",
|
|
278
278
|
{ extends: "paperlint:tex-base" },
|
|
279
279
|
"preset",
|
|
280
|
-
/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/,
|
|
280
|
+
/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, langcode-2027, msr-2027, naacl-2027, neurips-2026, neurips-style, nlbse-2027, realm-2026, sp-2027/,
|
|
281
281
|
],
|
|
282
282
|
[
|
|
283
283
|
"paperlint.json that is not JSON",
|