paperlint 18.9.1 → 19.0.1

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 (87) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CLAUDE.md +2 -2
  3. package/dist/adapters/eslint/index.d.ts +13 -0
  4. package/dist/adapters/eslint/index.d.ts.map +1 -0
  5. package/dist/adapters/eslint/index.js +44 -0
  6. package/dist/adapters/eslint/index.js.map +1 -0
  7. package/dist/adapters/eslint/report.io.d.ts +15 -0
  8. package/dist/adapters/eslint/report.io.d.ts.map +1 -0
  9. package/dist/adapters/eslint/report.io.js +48 -0
  10. package/dist/adapters/eslint/report.io.js.map +1 -0
  11. package/dist/cli.d.ts +7 -12
  12. package/dist/cli.d.ts.map +1 -1
  13. package/dist/cli.js +73 -110
  14. package/dist/cli.js.map +1 -1
  15. package/dist/domain/submission-lint.d.ts +29 -0
  16. package/dist/domain/submission-lint.d.ts.map +1 -0
  17. package/dist/domain/submission-lint.js +84 -0
  18. package/dist/domain/submission-lint.js.map +1 -0
  19. package/dist/ports/submission-lint.d.ts +6 -0
  20. package/dist/ports/submission-lint.d.ts.map +1 -0
  21. package/dist/ports/submission-lint.js +2 -0
  22. package/dist/ports/submission-lint.js.map +1 -0
  23. package/dist/structure.d.ts +17 -1
  24. package/dist/structure.d.ts.map +1 -1
  25. package/dist/structure.js.map +1 -1
  26. package/dist/submission-confirm-hook.d.ts +8 -1
  27. package/dist/submission-confirm-hook.d.ts.map +1 -1
  28. package/dist/submission-confirm-hook.js +75 -20
  29. package/dist/submission-confirm-hook.js.map +1 -1
  30. package/dist/submission.d.ts +5 -0
  31. package/dist/submission.d.ts.map +1 -1
  32. package/dist/submission.js +46 -7
  33. package/dist/submission.js.map +1 -1
  34. package/dist/types.d.ts +2 -0
  35. package/dist/types.d.ts.map +1 -1
  36. package/docs/submission.md +19 -8
  37. package/eslint.config.mjs +2 -0
  38. package/lib/skill-corpus.mjs +2 -113
  39. package/lib/skill-corpus.test.mjs +10 -11
  40. package/package.json +1 -2
  41. package/scripts/eslint-file-length.mjs +117 -0
  42. package/scripts/harness-api.frozen.json +0 -18
  43. package/skills/build-label-page/build-label-page.test.ts +2 -7
  44. package/skills/harden-paper/check-numbers.test.ts +104 -0
  45. package/skills/harden-paper/check-release-claims.test.ts +126 -0
  46. package/skills/label-agent-runs/label-agent-runs.harness.ts +2 -6
  47. package/skills/render-paper/render-paper.harness.mjs +153 -0
  48. package/skills/rewrite-unclear/rewrite-unclear.harness.ts +0 -5
  49. package/skills/run-agent-grid/run-agent-grid.harness.ts +2 -6
  50. package/skills/submit-paper/check-deanon.test.ts +165 -0
  51. package/src/adapters/eslint/index.test.ts +152 -0
  52. package/src/adapters/eslint/index.ts +89 -0
  53. package/src/adapters/eslint/report.io.ts +82 -0
  54. package/src/cli.ts +103 -134
  55. package/src/domain/submission-lint.test.ts +211 -0
  56. package/src/domain/submission-lint.ts +166 -0
  57. package/src/ports/submission-lint.ts +10 -0
  58. package/src/structure.ts +2 -4
  59. package/src/submission-confirm-hook-lint.test.ts +47 -0
  60. package/src/submission-confirm-hook.test.ts +73 -6
  61. package/src/submission-confirm-hook.ts +133 -28
  62. package/src/submission-fields-run.test.ts +1 -1
  63. package/src/submission-new.test.ts +4 -2
  64. package/src/submission-update.test.ts +16 -11
  65. package/src/submission.ts +62 -8
  66. package/src/types.ts +2 -0
  67. package/lib/skill-checks.d.mts +0 -10
  68. package/lib/skill-checks.mjs +0 -403
  69. package/lib/skill-checks.test.mjs +0 -288
  70. package/skills/analyze-sibling-paper/analyze-sibling-paper.harness.mjs +0 -23
  71. package/skills/argument-arc/argument-arc.harness.mjs +0 -23
  72. package/skills/build-benchmark/build-benchmark.harness.mjs +0 -23
  73. package/skills/camera-ready/camera-ready.harness.mjs +0 -23
  74. package/skills/cold-read-diff/cold-read-diff.harness.mjs +0 -21
  75. package/skills/draft-paper/draft-paper.harness.mjs +0 -23
  76. package/skills/extend-paper/extend-paper.harness.mjs +0 -23
  77. package/skills/find-venue/find-venue.harness.mjs +0 -23
  78. package/skills/harden-paper/harden-paper.harness.mjs +0 -23
  79. package/skills/map-prior-work/map-prior-work.harness.mjs +0 -23
  80. package/skills/paper-status/paper-status.harness.mjs +0 -25
  81. package/skills/pc-panel-review/pc-panel-review.harness.mjs +0 -24
  82. package/skills/plan-paper-timeline/plan-paper-timeline.harness.mjs +0 -23
  83. package/skills/research-ideate/research-ideate.harness.mjs +0 -23
  84. package/skills/study-accepted-papers/study-accepted-papers.harness.mjs +0 -23
  85. package/skills/submit-paper/submit-paper.harness.mjs +0 -23
  86. package/skills/tighten-paper/tighten-paper.harness.mjs +0 -23
  87. package/skills/verify-citations/verify-citations.harness.mjs +0 -23
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paperlint",
3
- "version": "18.9.1",
3
+ "version": "19.0.1",
4
4
  "description": "Skills and hooks for writing a research paper with paperlint",
5
5
  "skills": "./skills/",
6
6
  "hooks": "./plugin/hooks/hooks.json"
package/CLAUDE.md CHANGED
@@ -1,4 +1,4 @@
1
- <!-- vigiles:sha256:66d7a4e4745e9fae compiled from CLAUDE.md.spec.ts -->
1
+ <!-- vigiles:sha256:bd5aa64eb5260e8f compiled from CLAUDE.md.spec.ts -->
2
2
 
3
3
  # CLAUDE.md
4
4
 
@@ -107,7 +107,7 @@ Before writing machinery, **run the thing you are about to replace and paste its
107
107
 
108
108
  ### An Optional Tool Stays Out Of The Way
109
109
 
110
- **Guidance only** — Everything opt-in (a rule off by default, a set, a command that wraps an outside service, a skill, a hook) is judged by how little it costs an author who does not use it, and one who does it their own way. Off means silent: no finding, no notice, no prompt. Turned on and missing what it needs, it says so once, naming the one command or setting that answers it. It works with the author's own tool: a wrapper (an upload, a portal) writes the same documented file the author could write by hand or by script, and the rule reads that file, not the wrapper. Lint never calls the network. Nothing opt-in fails a build or blocks a submission; it warns. The author asked for this on 2026-11-21: "good DX, as long as it stays optional" and "not being annoying".
110
+ **Guidance only** — Everything opt-in (a rule off by default, a set, a command that wraps an outside service, a skill, a hook) is judged by how little it costs an author who does not use it, and one who does it their own way. Off means silent: no finding, no notice, no prompt. Turned on and missing what it needs, it says so once, naming the one command or setting that answers it. It works with the author's own tool: a wrapper (an upload, a portal) writes the same documented file the author could write by hand or by script, and the rule reads that file, not the wrapper. Lint never calls the network. Nothing opt-in ships at `error`: a set or rule paperlint documents as opt-in is turned on at `warn`, and only a severity the author writes can fail a build or block a submission (decided 2026-11-23, #635). The author asked for this on 2026-11-21: "good DX, as long as it stays optional" and "not being annoying".
111
111
 
112
112
  ### The Linter Is The Core
113
113
 
@@ -0,0 +1,13 @@
1
+ import type { ESLint } from "eslint";
2
+ import { type Result } from "../../domain/result.ts";
3
+ import { type LintFinding, type PaperSections } from "../../domain/submission-lint.ts";
4
+ import type { SubmissionLinter } from "../../ports/submission-lint.ts";
5
+ export { LINT_FORMAT, lintExitCode, lintResultFor, lintText, printLintResults, } from "./report.io.ts";
6
+ /** ESLint throws when the paths match no files or only ignored files. */
7
+ export declare function isEmptyLintSet(e: unknown): boolean;
8
+ /** Translate ESLint's structured diagnostics at the adapter boundary. */
9
+ export declare function lintFindings(results: readonly ESLint.LintResult[], paperDir: string): Result<readonly LintFinding[], string>;
10
+ export type OnLintResults = (results: readonly ESLint.LintResult[]) => void;
11
+ type RunPaperLint = (paperDir: string, cwd: string, onResults: OnLintResults) => Promise<string>;
12
+ export declare const submissionLinter: (runLint: RunPaperLint, sectionsOf: (paperDir: string) => PaperSections | null) => SubmissionLinter;
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/eslint/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIrC,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,aAAa,EACnB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAEvE,OAAO,EACL,WAAW,EACX,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AASxB,yEAAyE;AACzE,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAOlD;AAED,yEAAyE;AACzE,wBAAgB,YAAY,CAC1B,OAAO,EAAE,SAAS,MAAM,CAAC,UAAU,EAAE,EACrC,QAAQ,EAAE,MAAM,GACf,MAAM,CAAC,SAAS,WAAW,EAAE,EAAE,MAAM,CAAC,CAaxC;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,SAAS,MAAM,CAAC,UAAU,EAAE,KAAK,IAAI,CAAC;AAC5E,KAAK,YAAY,GAAG,CAClB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,aAAa,KACrB,OAAO,CAAC,MAAM,CAAC,CAAC;AAErB,eAAO,MAAM,gBAAgB,GAEzB,SAAS,YAAY,EACrB,YAAY,CAAC,QAAQ,EAAE,MAAM,KAAK,aAAa,GAAG,IAAI,KACrD,gBAmBC,CAAC"}
@@ -0,0 +1,44 @@
1
+ import { relative } from "node:path";
2
+ import { flatMap, map, partition } from "remeda";
3
+ import { z } from "zod";
4
+ import { err, ok } from "../../domain/result.js";
5
+ import { lintFindingLine, submissionLint, } from "../../domain/submission-lint.js";
6
+ import { messageOf } from "../../domain/text.js";
7
+ export { LINT_FORMAT, lintExitCode, lintResultFor, lintText, printLintResults, } from "./report.io.js";
8
+ const lintFailure = z
9
+ .object({
10
+ messageTemplate: z.string().optional(),
11
+ message: z.string().optional(),
12
+ })
13
+ .catch({});
14
+ /** ESLint throws when the paths match no files or only ignored files. */
15
+ export function isEmptyLintSet(e) {
16
+ const { messageTemplate, message } = lintFailure.parse(e);
17
+ return (messageTemplate === "file-not-found" ||
18
+ messageTemplate === "all-matched-files-ignored" ||
19
+ message?.toLowerCase().includes("no files matching") === true);
20
+ }
21
+ /** Translate ESLint's structured diagnostics at the adapter boundary. */
22
+ export function lintFindings(results, paperDir) {
23
+ const [fatal, findings] = partition(flatMap(results, ({ filePath, messages }) => map(messages, (m) => ({
24
+ ...m,
25
+ file: relative(paperDir, filePath).replaceAll("\\", "/") || ".",
26
+ }))), (m) => m.fatal === true);
27
+ return fatal.length === 0
28
+ ? ok(findings)
29
+ : err(map(fatal, lintFindingLine).join("\n"));
30
+ }
31
+ export const submissionLinter = (runLint, sectionsOf) => (paperDir, cwd) => new Promise((settle) => {
32
+ const accept = (results) => {
33
+ const findings = lintFindings(results, paperDir);
34
+ settle(findings.ok
35
+ ? ok(submissionLint(findings.value, sectionsOf(paperDir)))
36
+ : findings);
37
+ };
38
+ void runLint(paperDir, cwd, accept).then((problem) => {
39
+ settle(err(problem || "paperlint lint did not produce a report"));
40
+ }, (e) => {
41
+ settle(err(messageOf(e)));
42
+ });
43
+ });
44
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/eslint/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,EAAE,EAAe,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EACL,eAAe,EACf,cAAc,GAGf,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,EACL,WAAW,EACX,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,GAAG,CAAC;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GAC3B,CACE,OAAqB,EACrB,UAAsD,EACpC,EAAE,CACtB,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAE,CAChB,IAAI,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;IACrB,MAAM,MAAM,GAAkB,CAAC,OAAO,EAAE,EAAE;QACxC,MAAM,QAAQ,GAAG,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACjD,MAAM,CACJ,QAAQ,CAAC,EAAE;YACT,CAAC,CAAC,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;YAC1D,CAAC,CAAC,QAAQ,CACb,CAAC;IACJ,CAAC,CAAC;IACF,KAAK,OAAO,CAAC,QAAQ,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC,IAAI,CACtC,CAAC,OAAO,EAAE,EAAE;QACV,MAAM,CAAC,GAAG,CAAC,OAAO,IAAI,yCAAyC,CAAC,CAAC,CAAC;IACpE,CAAC,EACD,CAAC,CAAU,EAAE,EAAE;QACb,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC,CACF,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { ESLint } from "eslint";
2
+ export declare const LINT_FORMAT = "stylish";
3
+ export declare function lintResultFor(file: string, messages: readonly ESLint.LintResult["messages"][number][]): Readonly<ESLint.LintResult>;
4
+ /** Print the venue findings in the same format as the standalone lint command. */
5
+ export declare function lintText(file: string, messages: readonly ESLint.LintResult["messages"][number][]): Promise<string>;
6
+ interface ReportFormat {
7
+ readonly json: boolean;
8
+ readonly structure: readonly ESLint.LintResult[];
9
+ readonly structureText: string;
10
+ readonly log: (line: string) => void;
11
+ }
12
+ export declare function printLintResults(eslint: ESLint, results: readonly ESLint.LintResult[], { json, structure, structureText, log }: ReportFormat): Promise<boolean>;
13
+ export declare function lintExitCode(results: readonly ESLint.LintResult[], hasStructureErrors: boolean, maxWarnings: number, err: (line: string) => void): number;
14
+ export {};
15
+ //# sourceMappingURL=report.io.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.io.d.ts","sourceRoot":"","sources":["../../../src/adapters/eslint/report.io.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,eAAO,MAAM,WAAW,YAAY,CAAC;AAErC,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,SAAS,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,EAAE,GACzD,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAa7B;AAED,kFAAkF;AAClF,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,SAAS,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,EAAE,GACzD,OAAO,CAAC,MAAM,CAAC,CAIjB;AAED,UAAU,YAAY;IACpB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,CAAC,UAAU,EAAE,CAAC;IACjD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC;AAED,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,SAAS,MAAM,CAAC,UAAU,EAAE,EACrC,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,EAAE,EAAE,YAAY,GACpD,OAAO,CAAC,OAAO,CAAC,CAqBlB;AAED,wBAAgB,YAAY,CAC1B,OAAO,EAAE,SAAS,MAAM,CAAC,UAAU,EAAE,EACrC,kBAAkB,EAAE,OAAO,EAC3B,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC1B,MAAM,CASR"}
@@ -0,0 +1,48 @@
1
+ import { ESLint } from "eslint";
2
+ import { map, omit, sumBy } from "remeda";
3
+ export const LINT_FORMAT = "stylish";
4
+ export function lintResultFor(file, messages) {
5
+ const errorCount = messages.filter((m) => m.severity === 2).length;
6
+ return {
7
+ filePath: file,
8
+ messages: [...messages],
9
+ suppressedMessages: [],
10
+ errorCount,
11
+ fatalErrorCount: 0,
12
+ warningCount: messages.length - errorCount,
13
+ fixableErrorCount: 0,
14
+ fixableWarningCount: 0,
15
+ usedDeprecatedRules: [],
16
+ };
17
+ }
18
+ /** Print the venue findings in the same format as the standalone lint command. */
19
+ export async function lintText(file, messages) {
20
+ return (await new ESLint().loadFormatter(LINT_FORMAT)).format([
21
+ lintResultFor(file, messages),
22
+ ]);
23
+ }
24
+ export async function printLintResults(eslint, results, { json, structure, structureText, log }) {
25
+ if (json) {
26
+ log(JSON.stringify([...structure, ...map(results, (r) => omit(r, ["stats"]))], null, 1));
27
+ return false;
28
+ }
29
+ if (structure.length > 0)
30
+ log(structureText);
31
+ const out = await (await eslint.loadFormatter(LINT_FORMAT)).format([...results]);
32
+ const clean = out.trim() === "" && structure.length === 0;
33
+ log(out.trim() ||
34
+ (clean ? `✓ ${String(results.length)} file(s) checked, no findings` : ""));
35
+ return clean;
36
+ }
37
+ export function lintExitCode(results, hasStructureErrors, maxWarnings, err) {
38
+ if (hasStructureErrors || results.some((r) => r.errorCount > 0))
39
+ return 1;
40
+ if (maxWarnings < 0)
41
+ return 0;
42
+ const warnings = sumBy(results, (r) => r.warningCount);
43
+ if (!(warnings > maxWarnings))
44
+ return 0;
45
+ err(`${String(warnings)} warning(s) exceed the --max-warnings limit of ${String(maxWarnings)}`);
46
+ return 1;
47
+ }
48
+ //# sourceMappingURL=report.io.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.io.js","sourceRoot":"","sources":["../../../src/adapters/eslint/report.io.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ts CHANGED
@@ -27,8 +27,9 @@ import { ESLint, type Linter } from "eslint";
27
27
  import { isMain } from "../skills/paper-pipeline/scripts/consumer.mjs";
28
28
  export { isMain };
29
29
  import type { Args, PaperlintConfig, ConfigRead } from "./types.ts";
30
+ import { checkStructure } from "./structure.ts";
30
31
  import { runToolchain } from "./toolchain.ts";
31
- import { type VenueMessage } from "./venue-rules.ts";
32
+ export { lintText } from "./adapters/eslint/index.ts";
32
33
  import type { CheckReferences } from "./ports/check-references.ts";
33
34
  import type { PaperScope } from "./paper-files.ts";
34
35
  import { type TexRequirements } from "./tex-requirements.ts";
@@ -40,7 +41,7 @@ export { nextSteps } from "./init.ts";
40
41
  import { type LinkReport } from "./link-skills.ts";
41
42
  import type { ProjectInstall } from "./ports/project-install.ts";
42
43
  import type { ClaudeCode } from "./ports/claude-code.ts";
43
- import { type Upload } from "./submission-confirm-hook.ts";
44
+ import { type Send, type Upload } from "./submission-confirm-hook.ts";
44
45
  /** The config the user would otherwise write by hand. The data comes from `opts`, the mechanism is here. */
45
46
  export declare function buildConfig(opts: PaperlintConfig | undefined, texLanguage: unknown, papers?: PaperScope): ConfigBlock[];
46
47
  export declare function eslintConfig(blocks: readonly ConfigBlock[]): Linter.Config[];
@@ -133,10 +134,7 @@ export declare function toPaths(papers: unknown): string[];
133
134
  * (a flag missing its value, an unknown flag, a stray operand), so `submission-confirm` says it
134
135
  * cannot tell rather than guess.
135
136
  */
136
- export declare function submissionSend(words: readonly string[]): {
137
- readonly paper: string | null;
138
- readonly pdf: string | null;
139
- } | null;
137
+ export declare function submissionSend(words: readonly string[]): Send | null;
140
138
  /**
141
139
  * The words after `artifact`, read by this CLI's own parser, for an upload: the file it uploads, the
142
140
  * paper (null for the current folder), and the host and project it goes to — or null when they would
@@ -261,7 +259,8 @@ export declare function initTexLive(a: Args, { log, err, cwd, }: {
261
259
  readonly installed: () => boolean;
262
260
  readonly install: () => number;
263
261
  };
264
- export declare function run(argv: readonly string[], { log, err, cwd, now, checkReferences, loadTexLanguage, skillLinks, install, claude, }?: {
262
+ type LintResults = (results: readonly ESLint.LintResult[], structure: Readonly<ReturnType<typeof checkStructure>>) => void;
263
+ export declare function run(argv: readonly string[], { log, err, cwd, now, checkReferences, loadTexLanguage, skillLinks, install, claude, onLintResults, }?: {
265
264
  log?: typeof console.log;
266
265
  err?: typeof console.error;
267
266
  cwd?: string;
@@ -283,10 +282,6 @@ export declare function run(argv: readonly string[], { log, err, cwd, now, check
283
282
  checkReferences?: CheckReferences;
284
283
  /** The skills report `lint`'s stderr line reads; a test hands a fixed one. */
285
284
  skillLinks?: (root: string) => LinkReport;
285
+ onLintResults?: LintResults;
286
286
  }): Promise<number>;
287
- /**
288
- * Findings on one file, printed by the formatter `paperlint lint` prints with — what `paperlint
289
- * submission` shows of the venue rules before a send, so the two read the same.
290
- */
291
- export declare function lintText(file: string, messages: readonly VenueMessage[]): Promise<string>;
292
287
  //# sourceMappingURL=cli.d.ts.map
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAiB7C,OAAO,EAAE,MAAM,EAAE,MAAM,+CAA+C,CAAC;AAEvE,OAAO,EAAE,MAAM,EAAE,CAAC;AAClB,OAAO,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAiBpE,OAAO,EAAyB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAkBrE,OAAO,EAOL,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAC;AAsC1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAUnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAiBnD,OAAO,EAKL,KAAK,eAAe,EAC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, formatStructure, asEslintResults, } from "./structure.js";
41
41
  import { buildPapers, papersIn, anyFailed, remedyFor, MAIN } from "./build.js";
42
42
  import { FRAGMENT_FILES, includeBlocks, paperBodies, } from "./paper-includes.js";
43
- import { hasAtLeast, omit } from "remeda";
43
+ import { hasAtLeast } from "remeda";
44
44
  import { refusalOf } from "./unowned-file.js";
45
45
  import { ruleTimes, timingLines } from "./lint-timing.js";
46
46
  import { prepareEngine } from "./build-engine.js";
@@ -72,7 +72,9 @@ import { BIB_RULE_LEVELS, bibRules } from "./bib-rules.js";
72
72
  import { bibliographyReader } from "./references.js";
73
73
  import { onlineReferences } from "./adapters/references/index.js";
74
74
  import { hotcrpSite } from "./adapters/hotcrp/index.js";
75
- import { runSubmission } from "./submission.js";
75
+ import { runSubmission, submissionSections } from "./submission.js";
76
+ import { LINT_FORMAT, isEmptyLintSet, lintExitCode, lintResultFor, lintText, printLintResults, submissionLinter, } from "./adapters/eslint/index.js";
77
+ export { lintText } from "./adapters/eslint/index.js";
76
78
  import { ANY_PAPER, narrowToOwners, ownedPatterns, paperFiles, papersScope, ruleOwners, scopeToOwned, } from "./paper-files.js";
77
79
  import { paperPreset, settingsProblemLine, presetProblemText, resolvePreset, resolveShipped, bareSeriesText, shippedPresets, shippedSpec, shippedFolderNames, SHIPPED_PREFIX, } from "./presets.js";
78
80
  import { mergeRequirements, declaredUnion, requirementsFor, NO_REQUIREMENTS, } from "./tex-requirements.js";
@@ -159,7 +161,7 @@ const USAGE = `paperlint — machine-checkable gates for a paper kept in git
159
161
  into ~/.cache/paperlint/texlive (PAPERLINT_TEXLIVE_DIR overrides); a second
160
162
  run does nothing. --check: report what is missing, change nothing
161
163
  npx paperlint doctor say what is actually wired — and what only LOOKS wired
162
- npx paperlint submission new [paper] [--abstract <file>] [--save]
164
+ npx paperlint submission new [paper] [--abstract <file>] [--save] [--allow-lint-errors <reason>]
163
165
  create the paper's submission on the venue's portal: the title
164
166
  and abstract from the build, the authors from paperlint.json,
165
167
  the PDF. A DRY RUN unless --save; a save records the new id in
@@ -170,6 +172,7 @@ const USAGE = `paperlint — machine-checkable gates for a paper kept in git
170
172
  whether it is the local paper.pdf (sha256); flags a title,
171
173
  abstract or authors that are not the paper's
172
174
  npx paperlint submission update [paper] [--pdf <file>] [--abstract <file>] [--submit] [--save]
175
+ [--allow-lint-errors <reason>]
173
176
  send the PDF (default: the paper's own), the paper's title
174
177
  and abstract each when the portal holds another (--abstract:
175
178
  that file's text instead), or "submitted". A DRY RUN unless --save: the portal checks the
@@ -260,6 +263,7 @@ submission:
260
263
  --pdf <file> the PDF to compare (show) or send (update) instead of the paper's own
261
264
  --abstract <file> new, update: a plain-text file whose text is sent as the abstract
262
265
  --submit update: mark the submission submitted
266
+ --allow-lint-errors <reason> permit reported lint errors on a submission --save
263
267
  --save new, update: really create or change the submission. Without it, nothing
264
268
  is saved
265
269
 
@@ -1035,6 +1039,7 @@ const STRING_FLAGS = new Map([
1035
1039
  ["--kind", "kind"],
1036
1040
  ["--pdf", "pdf"],
1037
1041
  ["--abstract", "abstract"],
1042
+ ["--allow-lint-errors", "allowLintErrors"],
1038
1043
  ["--url", "url"],
1039
1044
  ["--host", "host"],
1040
1045
  ["--to", "to"],
@@ -1144,15 +1149,19 @@ const IN_PROCESS_HOOKS = {
1144
1149
  shellLeaves: leafCommandsNormalized,
1145
1150
  readSend: submissionSend,
1146
1151
  readUpload: uploadSend,
1152
+ lintPaper: lintSubmissionPaper,
1147
1153
  });
1148
1154
  }
1149
1155
  catch {
1150
1156
  return UNREADABLE_INPUT;
1151
1157
  }
1152
1158
  })();
1153
- if (said !== null)
1154
- out(`${JSON.stringify(said)}\n`);
1155
- return 0;
1159
+ const write = (result) => {
1160
+ if (result !== null)
1161
+ out(`${JSON.stringify(result)}\n`);
1162
+ return 0;
1163
+ };
1164
+ return said instanceof Promise ? said.then(write) : write(said);
1156
1165
  },
1157
1166
  };
1158
1167
  /**
@@ -1166,8 +1175,35 @@ export function submissionSend(words) {
1166
1175
  const clean = a.missingValue === undefined &&
1167
1176
  a.unknownFlag === undefined &&
1168
1177
  a.paths.length <= 2;
1169
- return clean ? { paper: a.paths[1] ?? null, pdf: a.pdf } : null;
1178
+ return clean
1179
+ ? {
1180
+ paper: a.paths[1] ?? null,
1181
+ pdf: a.pdf,
1182
+ action: a.paths[0] === "new" ? "create" : a.submit ? "submit" : "update",
1183
+ allowLintErrors: a.allowLintErrors?.trim(),
1184
+ }
1185
+ : null;
1170
1186
  }
1187
+ const lintSubmissionPaper = submissionLinter(async (paperDir, cwd, accept) => {
1188
+ const stderr = collector();
1189
+ await run(["lint", paperDir], {
1190
+ cwd,
1191
+ log: () => { },
1192
+ err: (line) => {
1193
+ stderr.write(`${line}\n`);
1194
+ },
1195
+ onLintResults: (results, structure) => {
1196
+ accept([
1197
+ ...asEslintResults(structure).map((r) => ({
1198
+ ...r,
1199
+ filePath: resolve(cwd, r.filePath),
1200
+ })),
1201
+ ...results,
1202
+ ]);
1203
+ },
1204
+ });
1205
+ return firstLine(stderr.text());
1206
+ }, (paperDir) => submissionSections(paperDir, { ...RECORD_DEPS, latex: latexReader }));
1171
1207
  /**
1172
1208
  * The words after `artifact`, read by this CLI's own parser, for an upload: the file it uploads, the
1173
1209
  * paper (null for the current folder), and the host and project it goes to — or null when they would
@@ -1720,6 +1756,7 @@ const SIMPLE = {
1720
1756
  abstract: a.abstract,
1721
1757
  submit: a.submit,
1722
1758
  save: a.save,
1759
+ allowLintErrors: a.allowLintErrors ?? undefined,
1723
1760
  }, {
1724
1761
  files: nodeFiles,
1725
1762
  presets: PRESET_DEPS,
@@ -1729,6 +1766,7 @@ const SIMPLE = {
1729
1766
  latex: latexReader,
1730
1767
  codec: sourcesCodec,
1731
1768
  lintText,
1769
+ lintPaper: lintSubmissionPaper,
1732
1770
  yaml: parseYaml,
1733
1771
  now: isoNow,
1734
1772
  log,
@@ -1866,21 +1904,22 @@ const selfInstallDeps = (install) => {
1866
1904
  };
1867
1905
  /** The LaTeX language, loaded when a lint needs it: only `lint` and the `lint-edited` hook do. */
1868
1906
  const loadLatexLanguage = async () => (await import("#eslint-rules/latex-language")).texLanguage;
1869
- export async function run(argv, { log = console.log, err = console.error, cwd = process.cwd(), now = () => performance.now(), checkReferences = onlineReferences, loadTexLanguage = loadLatexLanguage, skillLinks = readSkillLinks, install = projectInstall, claude = claudeCode(), } = {}) {
1907
+ /** A missing flag value must be reported before falling back to any default. */
1908
+ function argumentProblem(a) {
1909
+ if (a.missingValue)
1910
+ return (`${a.missingValue} needs a value — it was given none.\n` +
1911
+ `Without it the run would silently fall back to whatever config it discovers, which is not what the command line said.`);
1912
+ if (a.unknownFlag !== undefined)
1913
+ return `unknown flag \`${a.unknownFlag}\` — \`paperlint --help\` lists every flag`;
1914
+ return !a.help && a.cmd && a.cmd !== "submission" && a.allowLintErrors != null
1915
+ ? "--allow-lint-errors is only for submission new or update with --save"
1916
+ : null;
1917
+ }
1918
+ export async function run(argv, { log = console.log, err = console.error, cwd = process.cwd(), now = () => performance.now(), checkReferences = onlineReferences, loadTexLanguage = loadLatexLanguage, skillLinks = readSkillLinks, install = projectInstall, claude = claudeCode(), onLintResults, } = {}) {
1870
1919
  const a = parseArgs(argv);
1871
- // The refusal must come FIRST: behind a flag without a value there is usually a typo, or a
1872
- // substitution in CI that collapsed into nothing, and any continuation works on something other
1873
- // than what was asked for.
1874
- if (a.missingValue) {
1875
- err(`${a.missingValue} needs a value — it was given none.\n` +
1876
- `Without it the run would silently fall back to whatever config it discovers, which is ` +
1877
- `not what the command line said.`);
1878
- return 2;
1879
- }
1880
- if (a.unknownFlag !== undefined) {
1881
- err(`unknown flag \`${a.unknownFlag}\` — \`paperlint --help\` lists every flag`);
1882
- return 2;
1883
- }
1920
+ const problem = argumentProblem(a);
1921
+ if (problem !== null)
1922
+ return (err(problem), 2);
1884
1923
  if (a.help || !a.cmd) {
1885
1924
  log(USAGE);
1886
1925
  return a.help ? 0 : 2;
@@ -1976,7 +2015,7 @@ export async function run(argv, { log = console.log, err = console.error, cwd =
1976
2015
  results = await eslint.lintFiles(paths);
1977
2016
  }
1978
2017
  catch (e) {
1979
- if (isEmptySet(e))
2018
+ if (isEmptyLintSet(e))
1980
2019
  results = [];
1981
2020
  else
1982
2021
  throw e;
@@ -2004,6 +2043,7 @@ export async function run(argv, { log = console.log, err = console.error, cwd =
2004
2043
  .map((d) => join(d, MAIN))
2005
2044
  .filter((f) => existsSync(f)),
2006
2045
  bodies,
2046
+ onLintResults,
2007
2047
  });
2008
2048
  hooksLine(root, err, skillLinks, claude);
2009
2049
  // On stderr, so `--json` leaves stdout a clean array.
@@ -2091,25 +2131,7 @@ const editLinter = (loadTexLanguage) => async (dir) => {
2091
2131
  };
2092
2132
  };
2093
2133
  /** A result of the hook's new errors, with the counts the formatter prints recomputed. */
2094
- const counted = (r) => ({
2095
- filePath: r.filePath,
2096
- // Only errors reach the formatter: the hook reports nothing else.
2097
- messages: r.messages.map((m) => ({
2098
- ruleId: m.ruleId,
2099
- message: m.message,
2100
- line: m.line,
2101
- column: m.column,
2102
- endLine: m.endLine,
2103
- severity: 2,
2104
- })),
2105
- suppressedMessages: [],
2106
- errorCount: r.messages.length,
2107
- fatalErrorCount: 0,
2108
- warningCount: 0,
2109
- fixableErrorCount: 0,
2110
- fixableWarningCount: 0,
2111
- usedDeprecatedRules: [],
2112
- });
2134
+ const counted = (r) => lintResultFor(r.filePath, r.messages.map((m) => ({ ...m, severity: 2 })));
2113
2135
  /**
2114
2136
  * The first path that is a FILE paperlint does not lint, or null. ESLint would answer such a file
2115
2137
  * with a warning result ("File ignored because of a matching ignore pattern"), which counts as a
@@ -2124,91 +2146,32 @@ async function firstUnownedFile(eslint, paths) {
2124
2146
  return p;
2125
2147
  return null;
2126
2148
  }
2127
- /**
2128
- * ESLint's refusals of an empty set: nothing matched (`file-not-found`), or everything that matched
2129
- * is outside paperlint's scope (`all-matched-files-ignored` — a papers directory holding only
2130
- * vendored scripts). Both mean "nothing was linted", which the caller reports itself.
2131
- */
2132
- /** What a thrown ESLint error says about itself; anything else thrown says nothing. */
2133
- const EslintFailure = z
2134
- .object({
2135
- messageTemplate: z.string().optional(),
2136
- message: z.string().optional(),
2137
- })
2138
- .catch({});
2139
- const isEmptySet = (e) => {
2140
- const fail = EslintFailure.parse(e);
2141
- return (fail.messageTemplate === "file-not-found" ||
2142
- fail.messageTemplate === "all-matched-files-ignored" ||
2143
- /No files matching/i.test(String(fail.message)));
2144
- };
2145
- /**
2146
- * Findings on one file, printed by the formatter `paperlint lint` prints with — what `paperlint
2147
- * submission` shows of the venue rules before a send, so the two read the same.
2148
- */
2149
- export async function lintText(file, messages) {
2150
- const errorCount = messages.filter((m) => m.severity === 2).length;
2151
- const result = {
2152
- filePath: file,
2153
- messages: [...messages],
2154
- suppressedMessages: [],
2155
- errorCount,
2156
- fatalErrorCount: 0,
2157
- warningCount: messages.length - errorCount,
2158
- fixableErrorCount: 0,
2159
- fixableWarningCount: 0,
2160
- usedDeprecatedRules: [],
2161
- };
2162
- return (await new ESLint().loadFormatter(LINT_FORMAT)).format([result]);
2163
- }
2164
- /** The formatter `paperlint lint` prints with. */
2165
- const LINT_FORMAT = "stylish";
2166
2149
  /** Printed under a clean `lint`, the README's disclaimer in one line. */
2167
2150
  const CLEAN_RUN_REMINDER = "Check the venue's own call before you submit: a call can change between editions, and a check can miss a case.";
2168
2151
  /**
2169
2152
  * The end of `paperlint lint`: refuse an optional rule that reached no paper, print the findings, and
2170
2153
  * decide the exit code. Pulled out of `run` so each question has its own function.
2171
2154
  */
2172
- async function reportLint(eslint, results, structure, { a, log, err, where, opts, projectPapers, bodies, }) {
2155
+ async function reportLint(eslint, results, structure, { a, log, err, where, opts, projectPapers, bodies, onLintResults, }) {
2173
2156
  const silent = await silentOptionalRules(eslint, [...results.map((r) => r.filePath), ...projectPapers], opts, bodyFilesOf(bodies));
2174
2157
  if (silent.length > 0) {
2175
2158
  err(`${silent.join(", ")} is turned on in "rules", but no paper.tex of the project gets it — check the block's ` +
2176
2159
  `"files" (relative to ${where}). A rule that never runs reports exactly like a rule that passed.`);
2177
2160
  return 1;
2178
2161
  }
2179
- if (a.json)
2180
- log(JSON.stringify([
2181
- ...asEslintResults(structure),
2182
- ...results.map((r) => omit(r, ["stats"])),
2183
- ], null, 1));
2162
+ if (onLintResults !== undefined)
2163
+ onLintResults(results, structure);
2184
2164
  else {
2185
- // Missing things are printed FIRST: they explain why the report below may be suspiciously
2186
- // short. The reverse order would read as "all clean — oh, and also this".
2187
- if (structure.length > 0)
2188
- log(formatStructure(structure));
2189
- const out = await (await eslint.loadFormatter(LINT_FORMAT)).format(results);
2190
- const clean = out.trim() === "" && structure.length === 0;
2191
- log(out.trim() ||
2192
- (clean
2193
- ? `✓ ${String(results.length)} file(s) checked, no findings`
2194
- : ""));
2195
- // A clean run is the one result a reader could take as a guarantee, so it, and only it,
2196
- // carries the README's reminder. Findings speak for themselves; --json is for machines.
2165
+ const clean = await printLintResults(eslint, results, {
2166
+ json: a.json,
2167
+ structure: asEslintResults(structure),
2168
+ structureText: formatStructure(structure),
2169
+ log,
2170
+ });
2197
2171
  if (clean)
2198
2172
  log(` ${CLEAN_RUN_REMINDER}`);
2199
2173
  }
2200
- if (structure.length > 0 || results.some((r) => r.errorCount > 0))
2201
- return 1;
2202
- // Warnings fail the run only when the threshold is named EXPLICITLY. A negative threshold means
2203
- // "do not count them at all", and that is the default.
2204
- if (a.maxWarnings >= 0) {
2205
- const warnings = results.reduce((n, r) => n + r.warningCount, 0);
2206
- if (warnings > a.maxWarnings) {
2207
- err(`${String(warnings)} warning(s) exceed the --max-warnings limit of ${String(a.maxWarnings)}`);
2208
- return 1;
2209
- }
2210
- }
2211
- return 0;
2174
+ return lintExitCode(results, structure.length > 0, a.maxWarnings, err);
2212
2175
  }
2213
2176
  // 🔴 `isMain`, NOT A STRING COMPARISON. The first version wrote
2214
2177
  // if (import.meta.url === `file://${process.argv[1]}`)