paperlint 7.2.0 → 8.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.
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +1 -6
- package/dist/build.js.map +1 -1
- package/dist/cli.d.ts +3 -4
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +13 -42
- package/dist/cli.js.map +1 -1
- package/dist/eslint-rules/latex-language.d.ts.map +1 -1
- package/dist/eslint-rules/latex-language.js +10 -13
- package/dist/eslint-rules/latex-language.js.map +1 -1
- package/dist/eslint-rules/paper-context.js +2 -2
- package/dist/eslint-rules/paper-typography.d.ts.map +1 -1
- package/dist/eslint-rules/paper-typography.js +22 -91
- package/dist/eslint-rules/paper-typography.js.map +1 -1
- package/dist/eslint-rules/papers.d.ts +1 -3
- package/dist/eslint-rules/papers.d.ts.map +1 -1
- package/dist/eslint-rules/papers.js +2 -4
- package/dist/eslint-rules/papers.js.map +1 -1
- package/dist/eslint-rules/tex-build.d.ts.map +1 -1
- package/dist/eslint-rules/tex-build.js +8 -25
- package/dist/eslint-rules/tex-build.js.map +1 -1
- package/dist/init.d.ts +1 -4
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +3 -9
- package/dist/init.js.map +1 -1
- package/dist/lib/markdown.d.ts +5 -81
- package/dist/lib/markdown.d.ts.map +1 -1
- package/dist/lib/markdown.js +5 -116
- package/dist/lib/markdown.js.map +1 -1
- package/dist/lib/paper-config.d.ts.map +1 -1
- package/dist/lib/paper-config.js +0 -2
- package/dist/lib/paper-config.js.map +1 -1
- package/dist/lib/skill-eval-fixture.d.ts +6 -4
- package/dist/lib/skill-eval-fixture.d.ts.map +1 -1
- package/dist/lib/skill-eval-fixture.js +25 -18
- package/dist/lib/skill-eval-fixture.js.map +1 -1
- package/dist/new-paper.d.ts +5 -11
- package/dist/new-paper.d.ts.map +1 -1
- package/dist/new-paper.js +12 -23
- package/dist/new-paper.js.map +1 -1
- package/dist/paper-files.d.ts +4 -4
- package/dist/paper-prose.d.ts +17 -0
- package/dist/paper-prose.d.ts.map +1 -0
- package/dist/paper-prose.js +46 -0
- package/dist/paper-prose.js.map +1 -0
- package/dist/structure.d.ts.map +1 -1
- package/dist/structure.js +4 -3
- package/dist/structure.js.map +1 -1
- package/dist/types.d.ts +0 -2
- package/dist/types.d.ts.map +1 -1
- package/docs/configuration.md +7 -9
- package/docs/e2e.md +4 -6
- package/docs/prior-art/paper-folder-scaffolding.md +24 -29
- package/docs/rules/tex/claim-provenance.md +0 -1
- package/docs/rules.md +2 -6
- package/eslint-rules/latex-language.harness.mjs +3 -3
- package/eslint-rules/latex-language.ts +10 -13
- package/eslint-rules/paper-context.ts +2 -2
- package/eslint-rules/paper-typography.test.mjs +17 -85
- package/eslint-rules/paper-typography.ts +22 -98
- package/eslint-rules/papers.harness.mjs +1 -1
- package/eslint-rules/papers.ts +2 -4
- package/eslint-rules/tex-build.harness.mjs +2 -2
- package/eslint-rules/tex-build.ts +8 -25
- package/eslint.config.mjs +0 -1
- package/hooks/hooks.harness.ts +15 -15
- package/hooks/paper-edit-guard.hook.mjs +5 -8
- package/hooks/paper-edit-guard.test.ts +12 -3
- package/hooks/paper-skills-nudge.hook.mjs +2 -3
- package/hooks/paper-skills-nudge.test.ts +13 -3
- package/hooks/paper-status-gates.hook.mjs +2 -2
- package/hooks/paper-status-gates.test.ts +14 -2
- package/lib/markdown.test.mjs +5 -60
- package/lib/markdown.ts +9 -136
- package/lib/paper-config.ts +0 -2
- package/lib/skill-checks.test.mjs +4 -1
- package/lib/skill-eval-fixture.ts +25 -18
- package/package.json +1 -3
- package/presets/realm.jsonc +1 -1
- package/scripts/harness-api.frozen.json +0 -5
- package/skills/cold-read-diff/SKILL.md +3 -3
- package/skills/cold-read-diff/SKILL.md.spec.ts +2 -2
- package/skills/grade-paper-writing/SKILL.md +14 -22
- package/skills/grade-paper-writing/SKILL.md.spec.ts +13 -21
- package/skills/grade-paper-writing/__snapshots__/prose-lint.test.ts.snap +40 -26
- package/skills/grade-paper-writing/prose-lint.mjs +108 -278
- package/skills/grade-paper-writing/prose-lint.test.ts +184 -81
- package/skills/paper-adversarial-review/SKILL.md +2 -2
- package/skills/paper-adversarial-review/SKILL.md.spec.ts +1 -1
- package/skills/paper-pipeline/SKILL.md +9 -12
- package/skills/paper-pipeline/SKILL.md.spec.ts +8 -11
- package/skills/paper-pipeline/description-language.eval.mjs +25 -15
- package/skills/paper-pipeline/framing-vs-vocabulary.eval.mjs +25 -15
- package/skills/paper-pipeline/grade-paper-writing-ablation.eval.mjs +25 -15
- package/skills/paper-pipeline/pipeline-firing.eval.mjs +27 -16
- package/skills/paper-pipeline/pipeline-language.eval.mjs +25 -15
- package/skills/paper-pipeline/references/acceptance-gate.md +16 -20
- package/skills/paper-pipeline/references/artifact-checklist.md +4 -5
- package/skills/paper-pipeline/references/pipeline-status-template.md +1 -1
- package/skills/paper-pipeline/scripts/README.md +0 -4
- package/skills/paper-pipeline/scripts/extract-ref-facts.harness.mjs +8 -72
- package/skills/paper-pipeline/scripts/extract-ref-facts.mjs +48 -156
- package/skills/paper-pipeline/scripts/extract-ref-facts.test.mjs +81 -75
- package/skills/paper-pipeline/scripts/generated-code.harness.mjs +3 -3
- package/skills/paper-status/SKILL.md +2 -2
- package/skills/paper-status/SKILL.md.spec.ts +1 -1
- package/skills/render-paper/SKILL.md +2 -2
- package/skills/render-paper/SKILL.md.spec.ts +1 -1
- package/skills/render-paper/extract-pdf-facts.mjs +2 -2
- package/skills/tighten-paper/SKILL.md +29 -42
- package/skills/tighten-paper/SKILL.md.spec.ts +28 -41
- package/skills/verify-citations/scripts/bib-authors.check.test.mjs +0 -13
- package/skills/verify-citations/scripts/bib-authors.cli.test.ts +23 -11
- package/skills/verify-citations/scripts/bib-authors.mjs +8 -93
- package/skills/verify-citations/scripts/bib-authors.test.mjs +1 -44
- package/src/build.harness.mjs +2 -2
- package/src/build.test.ts +1 -1
- package/src/build.ts +1 -6
- package/src/cli.harness.mjs +26 -46
- package/src/cli.test.ts +32 -40
- package/src/cli.ts +14 -54
- package/src/folder-venue-rule.test.ts +1 -1
- package/src/init.test.ts +6 -7
- package/src/init.ts +3 -22
- package/src/lint-fix.test.ts +10 -4
- package/src/new-paper.harness.mjs +9 -28
- package/src/new-paper.test.ts +6 -6
- package/src/new-paper.ts +11 -30
- package/src/paper-files.test.ts +5 -4
- package/src/paper-files.ts +4 -4
- package/src/paper-prose.test.ts +49 -0
- package/src/paper-prose.ts +67 -0
- package/src/parse-args.test.ts +0 -1
- package/src/structure.harness.ts +5 -11
- package/src/structure.ts +4 -3
- package/src/types.ts +0 -2
- package/fixtures/real-markdown-paper/baseline.json +0 -22
- package/fixtures/real-markdown-paper/baseline.ts +0 -70
- package/skills/paper-pipeline/PIPELINE-MAP.md +0 -381
- package/skills/paper-pipeline/pipeline-firing.baseline.json +0 -270
- package/skills/paper-pipeline/references/sweep-2026-08-09-ideal-pipeline.md +0 -585
- package/skills/paper-pipeline/scripts/artifact-coverage.harness.mjs +0 -492
- package/skills/paper-pipeline/scripts/artifact-coverage.mjs +0 -397
- package/skills/paper-pipeline/scripts/artifact-coverage.test.ts +0 -86
- package/skills/paper-pipeline/scripts/check-provenance.mjs +0 -184
- package/skills/paper-pipeline/scripts/population-map.harness.mjs +0 -135
- package/skills/paper-pipeline/scripts/population-map.mjs +0 -188
- package/skills/paper-pipeline/scripts/population-map.test.mjs +0 -154
- package/skills/paper-pipeline/scripts/provenance.harness.mjs +0 -266
- package/skills/paper-pipeline/scripts/round-diff.harness.ts +0 -907
- package/skills/paper-pipeline/scripts/round-diff.mjs +0 -583
- package/skills/paper-pipeline/scripts/round-diff.test.mjs +0 -159
- package/skills/tighten-paper/__snapshots__/structure.test.ts.snap +0 -133
- package/skills/tighten-paper/structure.mjs +0 -364
- package/skills/tighten-paper/structure.test.ts +0 -117
- package/templates/paper/paper.md +0 -4
|
@@ -1,95 +1,35 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* prose-lint.mjs — countable checks for "reads machine-written" expository prose
|
|
4
|
-
*
|
|
3
|
+
* prose-lint.mjs — countable checks for "reads machine-written" expository prose, on a paper's
|
|
4
|
+
* LaTeX source or on the text of its rendered PDF.
|
|
5
|
+
* Usage: node prose-lint.mjs <paper.tex|page.txt> [more files] [--flags-only|--headings]
|
|
5
6
|
*
|
|
6
7
|
* Every check counts something. Thresholds and their provenance are in THRESHOLDS.
|
|
7
8
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* `papers/research/2026-08-26-klassifikatsiya-prose-lint.md`.
|
|
15
|
-
* Do NOT add them back: a fact has one home, and `paper-craft.harness.mjs` fails if the number of
|
|
16
|
-
* gating metrics here grows.
|
|
9
|
+
* A `.tex` IS READ THROUGH THE PAPER'S PROSE, NOT AS TEXT. Read raw, a `.tex` put the preamble, the
|
|
10
|
+
* `%` comments and the `filecontents` bibliography into the word count — measured on one paper:
|
|
11
|
+
* `8127 words` against ~4636 real ones — and every metric here is a fraction of that count, so all
|
|
12
|
+
* of them came out understated by about half and printed `ok`. `paperProse` (src/paper-prose.ts)
|
|
13
|
+
* gives the body as the `tex/register` rule reads it: includes spliced, the abstract to the back
|
|
14
|
+
* matter, no headings, captions, floats, code or citation marks.
|
|
17
15
|
*
|
|
18
|
-
*
|
|
19
|
-
* frameMarkersPer1000 → `paper/metadiscourse`, the `density` finding. The dictionary here was wider
|
|
20
|
-
* (17 patterns against 9), so the dictionaries were merged first and the threshold removed after.
|
|
21
|
-
* ⚠️ NOT all seventeen were merged: the patterns `\bfirst(ly)?\b(?=[ ,])` / `second` / `third`
|
|
22
|
-
* gave 23 matches out of 27 on `compile-rules-2026/paper.md`, and ZERO of them were REAL
|
|
23
|
-
* ("Only the second one runs", "The first two rows", "A third group ignores"). Those are
|
|
24
|
-
* ordinary adjectives. What went into the rule is Hyland's form — "First," at the start of a
|
|
25
|
-
* clause; over four papers it gives 9 matches, all real;
|
|
26
|
-
* epanorthosisPer10k → `paper/ai-tells`, together with all four forms and with Boggia's baseline.
|
|
27
|
-
* The receiving rule knew only one form, and that regex caught "is not X," WITHOUT the
|
|
28
|
-
* substituted replacement — five of its matches on a real paper were not the construction at
|
|
29
|
-
* all. Parity: the rule prints the same `17.2/10k` and the same 10 sentences.
|
|
16
|
+
* A `.txt` is the text of the rendered PDF — the page a reviewer actually reads.
|
|
30
17
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* ACTED ON. Measured: `eslint-rules/paper-registry.mjs` makes 8 disk accesses and reads neighbouring
|
|
34
|
-
* files of the paper's directory; `pdf-facts.mjs` opens a PDF and computes sha256; `paper-texcount.mjs`
|
|
35
|
-
* RUNS an external program through `execFileSync`. An ESLint rule executes in node, and `readFileSync`
|
|
36
|
-
* is available to it exactly as it is to this script. The real "one file at a time" model is about
|
|
37
|
-
* WHERE a rule reports, not about what it reads.
|
|
38
|
-
* ⇒ All three metrics were reclassified as MOVABLE and are queued as work:
|
|
39
|
-
* `node .claude/lib/refactor-state.mjs --index`, the "MOVABLE" section.
|
|
40
|
-
* `captionSentenceWords` / `captionWords` — after one edit of `files:` in `eslint.config.mjs`
|
|
41
|
-
* (today only the paper's own `paper.tex` is listed there, while the captions live in `figures/`).
|
|
42
|
-
*
|
|
43
|
-
* ✅ `abstractVsVenueMedian` WAS MOVED 2026-09-07 → `eslint-rules/paper-craft.mjs`, the rule
|
|
44
|
-
* `paper/abstract-length` (`warn`). It was the one "without a single condition": the median is read
|
|
45
|
-
* from the neighbouring `CLAUDE.md` exactly as `pdf/profile` reads a venue profile, and the address
|
|
46
|
-
* of the finding is the `## Abstract` line in the paper itself. Parity was taken BEFORE the deletion
|
|
47
|
-
* on `compile-rules-2026/paper.md`: 306 words against a ceiling of 305, one finding in both places,
|
|
48
|
-
* the same four numbers. The test is `eslint-rules/paper-craft.harness.mjs`.
|
|
49
|
-
*
|
|
50
|
-
* WHAT IS LEFT AND WHY — TWO. The paragraph below was written when there were three, and is kept as
|
|
51
|
-
* a record: they read a SECOND ENTITY on the filesystem, while an ESLint rule sees one linted file:
|
|
52
|
-
* ← RETRACTED, see above
|
|
53
|
-
* captionSentenceWords, captionWords → the input is `figures/*.tex` NEXT TO the paper.
|
|
54
|
-
*
|
|
55
|
-
* ⚠️ `.tex` IS NO LONGER ACCEPTED, AND THAT IS FIXING A LIE, NOT NARROWING THE SCOPE. The header
|
|
56
|
-
* declared `<file.md|file.tex|->` from the very beginning, while there is not one line of LaTeX
|
|
57
|
-
* stripping in the file. Measured 2026-08-26 on `agenticdev-2026/paper.tex`: it prints `8127 words`
|
|
58
|
-
* against ~4636 real ones — 43% of that is the preamble, `%` comments and `filecontents`
|
|
59
|
-
* bibliography entries, and the first items in the list of long sentences are `.bib` lines. Every
|
|
60
|
-
* metric in this file is a fraction of the word count, so on `.tex` they were all understated by
|
|
61
|
-
* roughly half and printed `ok`. Nobody ever called it with `.tex` anyway (CI explicitly prints
|
|
62
|
-
* `NOT COVERED` for .tex papers), so the cost of refusing is zero, while the cost of a confident
|
|
63
|
-
* wrong number is not. A LaTeX parser is deliberately not built here: the occupancy of the tools was
|
|
64
|
-
* measured separately, see `papers/research/2026-08-26-proza-v-latex-zanyatost.md`.
|
|
18
|
+
* The figure captions are measured too (`--flags-only`): every `\caption{}` in `paper.tex` and the
|
|
19
|
+
* files it includes, or, beside a rendered page, in `figures/*.tex`.
|
|
65
20
|
*
|
|
66
21
|
* Advisory: it prints findings; `--flags-only` exits with code 1 if anything was found.
|
|
67
22
|
*/
|
|
68
|
-
import {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
stripFrontmatter,
|
|
73
|
-
} from "#lib/markdown";
|
|
74
|
-
|
|
75
|
-
// Markup is parsed with a PARSER (`CLAUDE.md`, 2026-08-11). We fail rather than degrade, even
|
|
76
|
-
// though this file is advisory: without a parser the paper's body would collapse to empty, and from
|
|
77
|
-
// empty this linter derives zero for EVERY metric — that is, a report saying "the prose is perfect".
|
|
78
|
-
// `paper-lint.mjs` runs us as a subprocess and prints our stderr, so the reason is visible, and its
|
|
79
|
-
// own gate does not suffer: it swallows our exit code deliberately.
|
|
80
|
-
requireMarkdown();
|
|
23
|
+
import { paperProse } from "#src/paper-prose";
|
|
24
|
+
import { latexReader } from "#src/adapters/latex/index";
|
|
25
|
+
import { nodeFiles } from "#src/adapters/node/index";
|
|
26
|
+
import { texToMdast } from "#eslint-rules/latex-language";
|
|
81
27
|
|
|
82
28
|
const THRESHOLDS = {
|
|
83
|
-
// frameMarkersPer1000 — moved 2026-09-06 into `eslint-rules/paper-prose.mjs`, into the rule
|
|
84
|
-
// `paper/metadiscourse` (the `density` finding), together with Hyland's provenance and the
|
|
85
|
-
// threshold of 10. The FRAME_MARKERS dictionary below STAYS: it is a term in
|
|
86
|
-
// metadiscourseTotalPer1000.
|
|
87
29
|
metadiscourseTotalPer1000: {
|
|
88
30
|
warn: 90,
|
|
89
31
|
src: "Hyland 2005 Table 5.1 total 64.9/1000; Table 7.1 totals 60.0-73.6/1000. Warn ~1.4x.",
|
|
90
32
|
},
|
|
91
|
-
// pureFrameSentencePct / propositionsPerSentence — moved into `eslint-rules/paper-craft.mjs`
|
|
92
|
-
// as `discourse-subject` and `multi-claim-sentence` (2026-08-26).
|
|
93
33
|
firstMentionDefinites: {
|
|
94
34
|
warn: 3,
|
|
95
35
|
src: 'No published rate. Operationalises Pinker\'s curse of knowledge: "the X" on first mention presupposes shared knowledge.',
|
|
@@ -106,37 +46,17 @@ const THRESHOLDS = {
|
|
|
106
46
|
warn: 0,
|
|
107
47
|
src: "Gopen & Swan 1990 principle 2: put the new information you want emphasised in the stress position. A trailing citation/cross-reference/hedge wastes it.",
|
|
108
48
|
},
|
|
109
|
-
//
|
|
110
|
-
//
|
|
111
|
-
// stress-position detector. Deleting it would silently understate both metrics.
|
|
112
|
-
// epanorthosisPer10k — moved 2026-09-06 into `eslint-rules/paper-prose.mjs`, into the rule
|
|
113
|
-
// `paper/ai-tells`, together with the ONLY published baseline in the whole set
|
|
114
|
-
// (Boggia 2026, arXiv 2607.21498: humans 3.6, models 7.8 per 10 000 words; threshold 15.6) and
|
|
115
|
-
// together with the EPANORTHOSIS lexicon. The metric's history — "it was counted and PRINTED
|
|
116
|
-
// WITHOUT A THRESHOLD from the day the linter was written, sat at 29.8 through five editing
|
|
117
|
-
// passes, and the corpus owner found the tic by eye before the tool did, because measuring is not
|
|
118
|
-
// checking" — moved into the rule's header: it explains why a metric must have a threshold and not
|
|
119
|
-
// only a number.
|
|
49
|
+
// The HEDGES lexicon is a term in metadiscourseTotalPer1000 and in the wasted stress-position
|
|
50
|
+
// detector. Deleting it would silently understate both metrics.
|
|
120
51
|
|
|
121
52
|
contrastivePer10k: {
|
|
122
53
|
warn: 25,
|
|
123
54
|
src: 'ours. "rather than" is an ordinary connective; a pile of them is a register problem, but it is NOT the construction Boggia measured and must not borrow that baseline.',
|
|
124
55
|
},
|
|
125
|
-
// conceitsPer10k — moved into `eslint-rules/paper-craft.mjs` as `conceits` (2026-08-26).
|
|
126
|
-
|
|
127
|
-
// Abstract length, as a multiple of the TARGET VENUE's own median. The corpus owner, 2026-08-05:
|
|
128
|
-
// "abstract should be closer to median. no longer than 50% [more than] median". For REALM the measured
|
|
129
|
-
// median over all 34 archival papers is 203 words, so the ceiling is ~305. The previous guidance
|
|
130
|
-
// in this project pointed at the venue MAXIMUM (518) and was wrong in the way maxima always are:
|
|
131
|
-
// it licensed 654 words, longer than any abstract that workshop has ever published, and read as
|
|
132
|
-
// an introduction rather than an abstract. Measure the venue, take the median, allow half again.
|
|
133
56
|
|
|
134
|
-
//
|
|
135
|
-
//
|
|
136
|
-
//
|
|
137
|
-
// 🔴 FIGURE CAPTIONS ARE PROSE THAT NOTHING WAS READING. They live in figures/*.tex, not in
|
|
138
|
-
// paper.md, so every writing pass, every persona read and every threshold in paper-lint's pre-edit
|
|
139
|
-
// gate was blind to them by construction. Found 2026-08-05 when a reader hit a 136-word caption
|
|
57
|
+
// 🔴 FIGURE CAPTIONS ARE PROSE THAT NOTHING WAS READING. They sit in floats, outside the body
|
|
58
|
+
// the other metrics read, so every writing pass and every persona read was blind to them by
|
|
59
|
+
// construction. Found 2026-08-05 when a reader hit a 136-word caption
|
|
140
60
|
// containing a 54-word sentence — one word under the limit that would have blocked the same
|
|
141
61
|
// sentence had it been typed into the paper. An entire text surface, unchecked.
|
|
142
62
|
captionSentenceWords: {
|
|
@@ -149,13 +69,9 @@ const THRESHOLDS = {
|
|
|
149
69
|
},
|
|
150
70
|
};
|
|
151
71
|
|
|
152
|
-
// CONCEITS — moved into `eslint-rules/paper-craft.mjs` (the `conceits` rule, 2026-08-26)
|
|
153
|
-
// together with its whole tuning history.
|
|
154
|
-
|
|
155
72
|
// --- lexicons ---
|
|
156
|
-
// 🔴 FRAME_MARKERS
|
|
157
|
-
//
|
|
158
|
-
// understate that metric. ⚠️ AND HERE IS A KNOWN DEFECT, measured the same day and NOT fixed: the
|
|
73
|
+
// 🔴 FRAME_MARKERS has no threshold of its own: it is a term in `metadiscourseTotalPer1000`, and
|
|
74
|
+
// deleting it would silently understate that metric. ⚠️ AND HERE IS A KNOWN DEFECT, measured the same day and NOT fixed: the
|
|
159
75
|
// three ordinal-numeral patterns give 23 matches out of 27 on a real paper, and none of them are
|
|
160
76
|
// real, while `comes? first` is written TWICE (the second time as `come(s)? (first|before)`), so
|
|
161
77
|
// every "comes first" is counted as two. That means `metadiscourse/1000w` in the report below is
|
|
@@ -284,9 +200,6 @@ const NEGATORS = [
|
|
|
284
200
|
/\bfail(s|ed)? to\b/gi,
|
|
285
201
|
/\bunable\b/gi,
|
|
286
202
|
];
|
|
287
|
-
// EPANORTHOSIS — moved 2026-09-06 into `eslint-rules/paper-prose.mjs` (the `paper/ai-tells` rule)
|
|
288
|
-
// together with all four forms and with their history, including the one that turned the list into a
|
|
289
|
-
// list: the appositive "Admission, not translation", which reaches as far as HEADINGS.
|
|
290
203
|
|
|
291
204
|
/**
|
|
292
205
|
* `rather than` — moved OUT of EPANORTHOSIS on 2026-08-05, and the reason is arithmetic, not taste.
|
|
@@ -310,8 +223,6 @@ const CONTRASTIVE = [
|
|
|
310
223
|
// nominalisations: -tion/-sion/-ment/-ance/-ence/-ity/-ness/-ing used as head noun (approximate)
|
|
311
224
|
const NOMINAL = /\b\w{4,}(tion|sion|ment|ance|ence|ity|ness)s?\b/gi;
|
|
312
225
|
|
|
313
|
-
// JARGON — moved into `eslint-rules/paper-craft.mjs` (the `unexplained-jargon` rule, 2026-08-26).
|
|
314
|
-
|
|
315
226
|
/** Matches of every pattern in the lexicon `pats`, summed. Every caller passes a lexicon array. */
|
|
316
227
|
const count = (t, pats) =>
|
|
317
228
|
pats.reduce((n, p) => n + (t.match(p) || []).length, 0);
|
|
@@ -322,46 +233,27 @@ const count = (t, pats) =>
|
|
|
322
233
|
// remedy, and it was not wired into the report. Deleted; the hole — "the report prints counters
|
|
323
234
|
// without the offending lines" — is recorded here.
|
|
324
235
|
|
|
325
|
-
// 🔴 Paragraph
|
|
326
|
-
//
|
|
327
|
-
//
|
|
236
|
+
// 🔴 Paragraph boundaries END a sentence. The first version collapsed all whitespace first, so a
|
|
237
|
+
// heading ran into the paragraph under it and the last sentence of one paragraph ran into the first
|
|
238
|
+
// of the next. Measured 2026-08-05: that inflated "sentences carrying >2
|
|
328
239
|
// propositions" to 55, and the top offenders printed by the report were not sentences at all —
|
|
329
240
|
// they were a title glued to an abstract. The metric therefore looked like noise, which is exactly
|
|
330
241
|
// why nobody ever wired it into the flags that hooks and pre-commit consume. A miscounted metric
|
|
331
242
|
// does not get argued with; it gets ignored.
|
|
332
|
-
//
|
|
333
|
-
//
|
|
334
|
-
// both directions silently: it missed a heading indented by 1-3 spaces (CommonMark counts it as a
|
|
335
|
-
// heading) and struck out a `# …` line inside a ``` block — that is, CODE quoted by the paper fell
|
|
336
|
-
// soundlessly out of the sentence count, and this file counts nothing but sentences.
|
|
337
|
-
// The order is preserved: a line is struck out, not a paragraph, so the paragraph boundaries are
|
|
338
|
-
// the same.
|
|
339
|
-
function stripHeadingLines(t) {
|
|
340
|
-
const drop = new Set(mdHeadings(t).map((h) => h.line));
|
|
341
|
-
return drop.size === 0
|
|
342
|
-
? t
|
|
343
|
-
: t
|
|
344
|
-
.split("\n")
|
|
345
|
-
.filter((_, i) => !drop.has(i))
|
|
346
|
-
.join("\n");
|
|
347
|
-
}
|
|
243
|
+
// Headings never reach this function: the paper's prose comes without them (`paperProse`), and a
|
|
244
|
+
// rendered page sets them as lines of their own.
|
|
348
245
|
function splitSentences(t) {
|
|
349
|
-
return
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
.split(/(?<=[.!?])\s+(?=[A-Z“"(*`])/),
|
|
361
|
-
)
|
|
362
|
-
.map((s) => s.trim())
|
|
363
|
-
.filter(Boolean)
|
|
364
|
-
);
|
|
246
|
+
return t
|
|
247
|
+
.split(/\n\s*\n/) // paragraphs never run together
|
|
248
|
+
.flatMap((p) =>
|
|
249
|
+
p
|
|
250
|
+
.split("\n")
|
|
251
|
+
.join(" ")
|
|
252
|
+
.replace(/\s+/g, " ")
|
|
253
|
+
.split(/(?<=[.!?])\s+(?=[A-Z“"(*`])/),
|
|
254
|
+
)
|
|
255
|
+
.map((s) => s.trim())
|
|
256
|
+
.filter(Boolean);
|
|
365
257
|
}
|
|
366
258
|
const words = (t) => (t.match(/[A-Za-z0-9%.'’-]+/g) || []).length;
|
|
367
259
|
|
|
@@ -390,11 +282,7 @@ function analyse(text, sents) {
|
|
|
390
282
|
};
|
|
391
283
|
const mdTotal = Object.values(cats).reduce((a, b) => a + b, 0);
|
|
392
284
|
|
|
393
|
-
//
|
|
394
|
-
// `props` (>2 propositions) and the "discourse subject" moved into
|
|
395
|
-
// `eslint-rules/paper-craft.mjs` — the rules `multi-claim-sentence` and `discourse-subject`
|
|
396
|
-
// (2026-08-26). What stayed here is the wasted stress position, negation and the topic position:
|
|
397
|
-
// they had no thresholds in the gate and still have none, they are printed by the report.
|
|
285
|
+
// Per sentence: the wasted stress position, negation and the topic position.
|
|
398
286
|
const perSent = sents.map((s) => {
|
|
399
287
|
const sw = words(s);
|
|
400
288
|
const frame = count(s, FRAME_MARKERS);
|
|
@@ -455,55 +343,35 @@ function analyse(text, sents) {
|
|
|
455
343
|
};
|
|
456
344
|
}
|
|
457
345
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
/**
|
|
462
|
-
* An inventory of headings — all that is left of `structure()`.
|
|
463
|
-
*
|
|
464
|
-
* 🔴 The two checks that lived here (citation density in a paragraph and a pile-up of jargon in a
|
|
465
|
-
* sentence) moved on 2026-08-26 into `eslint-rules/paper-craft.mjs` — `citation-density` and
|
|
466
|
-
* `unexplained-jargon`. The reason they were SEPARATE from `analyse()` has not gone anywhere and is
|
|
467
|
-
* now expressed by construction: an ESLint rule has the document tree, so the question "how many
|
|
468
|
-
* stops are in THIS paragraph" is asked directly rather than reconstructed from a collapsed stream
|
|
469
|
-
* of words.
|
|
470
|
-
*/
|
|
471
|
-
function structure(body) {
|
|
472
|
-
// Not a gate — an INVENTORY. "A heading names a concrete noun" is a judgement call and pretending
|
|
473
|
-
// otherwise would be the failure this file exists to stop. What is mechanical, and what was
|
|
474
|
-
// missing, is that nobody ever saw all the headings AT ONCE: the whole-document question. Two
|
|
475
|
-
// headings a reader called "VAGUE AF" and "why not mention the linter??" survived six passes
|
|
476
|
-
// because each pass looked at the section it was editing.
|
|
477
|
-
// 2026-08-11: the heading inventory comes from the parser. The previous `/^#{2,4} .+$/gm` also
|
|
478
|
-
// printed lines from ``` blocks in this list: an inventory read BY EYE as "all the paper's
|
|
479
|
-
// headings" silently mixed them with quotations of someone else's markup. The parser hands back
|
|
480
|
-
// the heading text already trimmed at the edges — the previous `.replace(/^#+\s*/, '')` left
|
|
481
|
-
// trailing spaces.
|
|
482
|
-
const headings = mdHeadings(body)
|
|
483
|
-
.filter((h) => h.depth >= 2 && h.depth <= 4)
|
|
484
|
-
.map((h) => h.text);
|
|
485
|
-
|
|
486
|
-
// 🔴 The document's SHAPE — outline, order, section weights — deliberately does NOT live here.
|
|
487
|
-
// It was written here first and the author drew the line correctly: "I thought prose was about
|
|
488
|
-
// prose, and structure is something else entirely" (said in Russian). Prose-lint judges sentences.
|
|
489
|
-
// Structure belongs to tighten-paper, which had no mechanical leg at all, so the inventory now
|
|
490
|
-
// lives there:
|
|
491
|
-
// node .claude/skills/tighten-paper/structure.mjs <paper.md> [--section=N]
|
|
492
|
-
return { headings };
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
/** Captions from figures/*.tex beside the paper — the text surface nothing was reading. */
|
|
496
|
-
function captions(paperPath, fs, path) {
|
|
497
|
-
const dir = path.join(path.dirname(paperPath), "figures");
|
|
346
|
+
/** The `.tex` files of `figures/` beside a rendered page, each as `{ file, text }`. */
|
|
347
|
+
function figureFiles(pagePath, fs, path) {
|
|
348
|
+
const dir = path.join(path.dirname(pagePath), "figures");
|
|
498
349
|
let files; // no initialiser: the catch branch returns, only try assigns (2026-08-28)
|
|
499
350
|
try {
|
|
500
351
|
files = fs.readdirSync(dir).filter((f) => f.endsWith(".tex"));
|
|
501
352
|
} catch {
|
|
502
353
|
return [];
|
|
503
354
|
}
|
|
355
|
+
return files.map((f) => ({
|
|
356
|
+
file: `figures/${f}`,
|
|
357
|
+
text: fs.readFileSync(path.join(dir, f), "utf8"),
|
|
358
|
+
}));
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Every `\caption{…}` of `sources` (`{ file, text }`) a reader sees, measured. The LaTeX
|
|
363
|
+
* language's projection blanks what never typesets — verbatim and code, macro definitions, the
|
|
364
|
+
* preamble — and keeps a caption's argument; it keeps comments too, as `html` nodes of its tree,
|
|
365
|
+
* for the rules that read notes. So a caption is skipped when its argument is blank in the
|
|
366
|
+
* projection or it starts inside a comment: a quoted or commented-out `\caption` is not one.
|
|
367
|
+
*/
|
|
368
|
+
function captions(sources) {
|
|
504
369
|
const out = [];
|
|
505
|
-
for (const f of
|
|
506
|
-
const
|
|
370
|
+
for (const { file: f, text: s } of sources) {
|
|
371
|
+
const { root, text: seen } = texToMdast(s);
|
|
372
|
+
const comments = root.children
|
|
373
|
+
.filter((n) => n.type === "html")
|
|
374
|
+
.map((n) => [n.position.start.offset, n.position.end.offset]);
|
|
507
375
|
for (const m of s.matchAll(/\\caption\{/g)) {
|
|
508
376
|
let i = m.index + m[0].length,
|
|
509
377
|
depth = 1,
|
|
@@ -513,6 +381,11 @@ function captions(paperPath, fs, path) {
|
|
|
513
381
|
else if (s[j] === "}") depth--;
|
|
514
382
|
j++;
|
|
515
383
|
}
|
|
384
|
+
if (
|
|
385
|
+
!/\S/.test(seen.slice(i, j - 1)) ||
|
|
386
|
+
comments.some(([a, b]) => m.index >= a && m.index < b)
|
|
387
|
+
)
|
|
388
|
+
continue;
|
|
516
389
|
const text = s
|
|
517
390
|
.slice(i, j - 1)
|
|
518
391
|
.replace(/\\[a-zA-Z]+\s*/g, " ")
|
|
@@ -521,13 +394,13 @@ function captions(paperPath, fs, path) {
|
|
|
521
394
|
.replace(/\s+/g, " ")
|
|
522
395
|
.trim();
|
|
523
396
|
if (!text) continue;
|
|
397
|
+
// A non-empty caption splits into at least one sentence.
|
|
524
398
|
const sents = splitSentences(text);
|
|
525
399
|
out.push({
|
|
526
400
|
file: f,
|
|
527
401
|
words: words(text),
|
|
528
|
-
longest: Math.max(
|
|
529
|
-
longestSentence:
|
|
530
|
-
sents.slice().sort((a, b) => words(b) - words(a))[0] ?? "",
|
|
402
|
+
longest: Math.max(...sents.map(words)),
|
|
403
|
+
longestSentence: sents.slice().sort((a, b) => words(b) - words(a))[0],
|
|
531
404
|
});
|
|
532
405
|
}
|
|
533
406
|
}
|
|
@@ -544,18 +417,9 @@ function report(name, r) {
|
|
|
544
417
|
`${flag(r.metadiscoursePer1000 <= THRESHOLDS.metadiscourseTotalPer1000.warn)} all metadiscourse/1000w ${r.metadiscoursePer1000} (Hyland RA baseline 64.9, warn >${THRESHOLDS.metadiscourseTotalPer1000.warn})`,
|
|
545
418
|
);
|
|
546
419
|
console.log(` nominalisations/1000w ${r.nominalisationsPer1000}`);
|
|
547
|
-
// "not X, but Y" and the frame-marker density were printed from here until 2026-09-06. Both moved
|
|
548
|
-
// into `eslint-rules/paper-prose.mjs`, where a finding has a `file:line:col`; printing them here a
|
|
549
|
-
// second time would set up a second source of truth:
|
|
550
|
-
// npx eslint papers/*/paper.md papers/*/paper.tex
|
|
551
420
|
console.log(
|
|
552
421
|
`${flag(r.contrastivePer10k <= THRESHOLDS.contrastivePer10k.warn)} "rather than"/instead-of/10,000w ${r.contrastivePer10k} (warn >${THRESHOLDS.contrastivePer10k.warn}; not epanorthosis, no published baseline)`,
|
|
553
422
|
);
|
|
554
|
-
// Conceits, coined terms, sentences about the text and multi-proposition sentences were printed
|
|
555
|
-
// from here until 2026-08-26. They moved into `eslint-rules/paper-craft.mjs`, where every finding
|
|
556
|
-
// has a `file:line:col` — whereas this report printed their heads and made you hunt for the
|
|
557
|
-
// sentence by eye. Printing them here a second time would set up a second source of truth:
|
|
558
|
-
// `npx eslint papers/*/paper.md`.
|
|
559
423
|
console.log(
|
|
560
424
|
`${flag(r.wastedStress.length === 0)} sentences ending on a cross-ref/citation/hedge (wasted stress position): ${r.wastedStress.length}`,
|
|
561
425
|
);
|
|
@@ -570,43 +434,32 @@ function report(name, r) {
|
|
|
570
434
|
|
|
571
435
|
const args = process.argv.slice(2);
|
|
572
436
|
if (args.length === 0) {
|
|
573
|
-
console.error(
|
|
437
|
+
console.error(
|
|
438
|
+
"usage: node prose-lint.mjs <paper.tex|page.txt> [more files] [--flags-only|--headings]",
|
|
439
|
+
);
|
|
574
440
|
process.exit(0);
|
|
575
441
|
}
|
|
576
442
|
|
|
577
|
-
//
|
|
578
|
-
//
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
const tex = args.filter((a) => !a.startsWith("--") && a.endsWith(".tex"));
|
|
584
|
-
if (tex.length) {
|
|
585
|
-
console.error(`prose-lint reads markdown, not LaTeX: ${tex.join(", ")}`);
|
|
586
|
-
console.error(
|
|
587
|
-
"There is no .tex stripping here — the word count would include the preamble and the .bib,",
|
|
588
|
-
);
|
|
443
|
+
// A paper's source is its `paper.tex`, and a `.txt` is its rendered page. Anything else would be
|
|
444
|
+
// measured as if it were prose, with no way to tell its markup from its sentences.
|
|
445
|
+
const unread = args.filter(
|
|
446
|
+
(a) => !a.startsWith("--") && !a.endsWith(".tex") && !a.endsWith(".txt"),
|
|
447
|
+
);
|
|
448
|
+
if (unread.length) {
|
|
589
449
|
console.error(
|
|
590
|
-
|
|
591
|
-
);
|
|
592
|
-
console.error(
|
|
593
|
-
"What to cover prose in .tex with — papers/research/2026-08-26-proza-v-latex-zanyatost.md",
|
|
450
|
+
`prose-lint reads a paper.tex or the text of its rendered PDF (.txt), not: ${unread.join(", ")}`,
|
|
594
451
|
);
|
|
595
452
|
process.exit(2);
|
|
596
453
|
}
|
|
454
|
+
|
|
597
455
|
const fs = await import("node:fs");
|
|
598
456
|
const path = await import("node:path");
|
|
599
457
|
|
|
600
|
-
// 🔴 The
|
|
601
|
-
// comments, the YAML frontmatter and the keyword block as prose -- and its loudest complaints were
|
|
602
|
-
// about text no reviewer will ever see. Found 2026-08-04 on its first real run, where it reported
|
|
603
|
-
// the frontmatter's `title:` line as a six-proposition sentence. Strip what the converter strips.
|
|
604
|
-
// (It also caught something real that way: the frontmatter title was two revisions stale.)
|
|
605
|
-
// 🔴 The RENDERED page, not the markdown. Added 2026-08-05 after the author asked why the render
|
|
458
|
+
// 🔴 The RENDERED page, not only the source. Added 2026-08-05 after the author asked why the render
|
|
606
459
|
// step had not caught a stall he found by opening the PDF. It had not because nothing reads the
|
|
607
|
-
// rendered text: build
|
|
608
|
-
//
|
|
609
|
-
//
|
|
460
|
+
// rendered text: the build checks FORM — page count, overfull boxes, unresolved references, unset
|
|
461
|
+
// characters, the anonymity grep — and never looks at a sentence, while every prose check reads the
|
|
462
|
+
// source and never sees a typeset page. Between those two layers sat every
|
|
610
463
|
// defect he found by eye, and he was the only reader of the artifact a reviewer actually gets.
|
|
611
464
|
function pdfTextOnly(t) {
|
|
612
465
|
const cut = t.search(/^\s*References\s*$/m);
|
|
@@ -617,28 +470,6 @@ function pdfTextOnly(t) {
|
|
|
617
470
|
.replace(/\f/g, "\n\n");
|
|
618
471
|
}
|
|
619
472
|
|
|
620
|
-
// 2026-08-11: code blocks are cut out by `stripFences()`, and the parser finds the body boundary.
|
|
621
|
-
// The previous `/^```[\s\S]*?^```/gm`, with an ODD number of fences, glued the end of one block to
|
|
622
|
-
// the beginning of the next and ate the prose between them — and eaten prose here means an
|
|
623
|
-
// understated density for every metric, that is, a clean verdict over a dirty paper. And
|
|
624
|
-
// `/^## (References|Limitations)/m` cut the body at hashes INSIDE such a block.
|
|
625
|
-
function bodyOnly(t) {
|
|
626
|
-
t = stripFrontmatter(t); // YAML frontmatter
|
|
627
|
-
t = t.replace(/<!--[\s\S]*?-->/g, ""); // working comments, incl. TIGHTEN letters
|
|
628
|
-
// `blank: true` — the block's lines become empty rather than disappear. Otherwise the paragraph
|
|
629
|
-
// before the block gets glued to the paragraph after it, and this file is precisely about
|
|
630
|
-
// "Paragraph and heading boundaries END a sentence" (see the comment at `splitSentences`). The
|
|
631
|
-
// measurement is in the `stripFences` docstring: on `aisec-2026/README.md` removing the lines gave
|
|
632
|
-
// 81 sentences instead of 82, merging the lead paragraph with the text after the block.
|
|
633
|
-
t = stripFences(t, { blank: true }); // code blocks
|
|
634
|
-
t = t.replace(/^\|.*\|$/gm, ""); // table rows: data, not prose
|
|
635
|
-
const freeH = mdHeadings(t).find(
|
|
636
|
-
(h) => h.depth === 2 && /^(References|Limitations)/u.test(h.text),
|
|
637
|
-
);
|
|
638
|
-
const cut = freeH ? freeH.offset : -1; // the `-1` convention and the `> 0` comparison — as before
|
|
639
|
-
return cut > 0 ? t.slice(0, cut) : t; // body only; free sections hold a different bar
|
|
640
|
-
}
|
|
641
|
-
|
|
642
473
|
// 🔴 `--flags-only` and a NON-ZERO EXIT, added 2026-08-05, are what let anything downstream act.
|
|
643
474
|
// Until today this file printed a wall of numbers and always exited 0, and it was wired to no hook
|
|
644
475
|
// at all — it ran only if a human or a skill remembered it existed. Its epanorthosis metric sat at
|
|
@@ -650,46 +481,39 @@ const flagsOnly = args.includes("--flags-only");
|
|
|
650
481
|
let flagged = 0;
|
|
651
482
|
for (const f of args.filter((a) => !a.startsWith("--"))) {
|
|
652
483
|
const raw = fs.readFileSync(f, "utf8");
|
|
653
|
-
const
|
|
654
|
-
|
|
484
|
+
const tex = f.endsWith(".tex")
|
|
485
|
+
? paperProse(path.resolve(f), raw, { files: nodeFiles, latex: latexReader })
|
|
486
|
+
: null;
|
|
655
487
|
// 🔴 NOTHING LEFT IS NOT "CLEAN". A body that strips to no words used to be analysed anyway: every
|
|
656
488
|
// metric is a fraction of the word count, so the report printed NaN, FLAGged three metrics and
|
|
657
|
-
// exited 0. Refused
|
|
658
|
-
//
|
|
659
|
-
|
|
660
|
-
const text = prep(raw);
|
|
489
|
+
// exited 0. Refused — no number is better than a meaningless one. The test is on sentences: a
|
|
490
|
+
// zero sentence count divides just the same as a zero word count.
|
|
491
|
+
const text = tex ? tex.body : pdfTextOnly(raw);
|
|
661
492
|
const sentences = splitSentences(text);
|
|
662
493
|
if (sentences.length === 0) {
|
|
663
494
|
console.error(
|
|
664
|
-
|
|
665
|
-
|
|
495
|
+
tex
|
|
496
|
+
? `prose-lint: ${f} has no prose to measure — after the preamble, comments, floats and ` +
|
|
497
|
+
"the back matter are left out, no word is left."
|
|
498
|
+
: `prose-lint: ${f} has no prose to measure — no sentence is left before the references.`,
|
|
666
499
|
);
|
|
667
500
|
process.exit(2);
|
|
668
501
|
}
|
|
669
502
|
const r = analyse(text, sentences);
|
|
670
503
|
if (flagsOnly) {
|
|
671
504
|
const lines = [];
|
|
672
|
-
//
|
|
673
|
-
// `
|
|
674
|
-
for (const c of captions(f, fs, path)) {
|
|
505
|
+
// A paper's captions are in its own files — paper.tex and what it includes, wherever a figure
|
|
506
|
+
// is set; a rendered page has the `.tex` of `figures/` beside it.
|
|
507
|
+
for (const c of captions(tex ? tex.files : figureFiles(f, fs, path))) {
|
|
675
508
|
if (c.longest > THRESHOLDS.captionSentenceWords.warn)
|
|
676
509
|
lines.push(
|
|
677
|
-
`
|
|
510
|
+
` ${c.file}: caption sentence of ${c.longest} words (warn >${THRESHOLDS.captionSentenceWords.warn}) — "${c.longestSentence.slice(0, 110)}…"`,
|
|
678
511
|
);
|
|
679
512
|
if (c.words > THRESHOLDS.captionWords.warn)
|
|
680
513
|
lines.push(
|
|
681
|
-
`
|
|
514
|
+
` ${c.file}: caption is ${c.words} words (warn >${THRESHOLDS.captionWords.warn}) — a caption this long is a section under a picture`,
|
|
682
515
|
);
|
|
683
516
|
}
|
|
684
|
-
// Sentences carrying more than two claims moved to the same place — the rule
|
|
685
|
-
// `multi-claim-sentence`, together with the "five worst" slice (now the `maxReported` option).
|
|
686
|
-
// ✅ Abstract length against the venue's median moved on 2026-09-07 into
|
|
687
|
-
// `eslint-rules/paper-craft.mjs` — the rule `paper/abstract-length`. Parity was taken BEFORE the
|
|
688
|
-
// deletion on a real paper: `compile-rules-2026/paper.md` — 306 words against a ceiling of 305
|
|
689
|
-
// (median 203 × 1.5), one finding here and one there, the same four numbers; the rule
|
|
690
|
-
// additionally carries the address `paper.md:126:1`, which this line never had.
|
|
691
|
-
// Hedges, sentences about the text and coined terms are there too:
|
|
692
|
-
// `hedge-density`, `discourse-subject`, `undefined-coinage`.
|
|
693
517
|
if (lines.length) {
|
|
694
518
|
flagged += lines.length;
|
|
695
519
|
// The header STATES the count, so a caller need not count output lines — header and footer
|
|
@@ -699,7 +523,7 @@ for (const f of args.filter((a) => !a.startsWith("--"))) {
|
|
|
699
523
|
);
|
|
700
524
|
lines.forEach((l) => console.error(l));
|
|
701
525
|
console.error(
|
|
702
|
-
" run
|
|
526
|
+
" run prose-lint.mjs on the file without --flags-only for the sentences",
|
|
703
527
|
);
|
|
704
528
|
}
|
|
705
529
|
} else if (args.includes("--headings")) {
|
|
@@ -708,8 +532,14 @@ for (const f of args.filter((a) => !a.startsWith("--"))) {
|
|
|
708
532
|
// exists to stop. What was missing is cheaper and was the real cause — nobody had ever seen the
|
|
709
533
|
// headings AS A SET. Two that a reader called "VAGUE AF" and "why not mention the linter??"
|
|
710
534
|
// survived six passes because every pass looked only at the section it was editing.
|
|
535
|
+
if (!tex) {
|
|
536
|
+
console.error(
|
|
537
|
+
`prose-lint: --headings reads a paper.tex — a rendered page (${f}) marks no heading`,
|
|
538
|
+
);
|
|
539
|
+
process.exit(2);
|
|
540
|
+
}
|
|
711
541
|
console.log(`\n=== ${f.split("/").pop()} — every heading, in order ===`);
|
|
712
|
-
|
|
542
|
+
tex.headings.forEach((h, i) =>
|
|
713
543
|
console.log(`${String(i + 1).padStart(3)}. ${h}`),
|
|
714
544
|
);
|
|
715
545
|
console.log(
|