paperlint 2.1.0 → 3.1.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.md +6 -1
- package/README.md +243 -235
- package/action.yml +4 -6
- package/dist/adapters/references/index.d.ts +13 -0
- package/dist/adapters/references/index.d.ts.map +1 -0
- package/dist/adapters/references/index.js +55 -0
- package/dist/adapters/references/index.js.map +1 -0
- package/dist/adapters/references/reach.io.d.ts +3 -0
- package/dist/adapters/references/reach.io.d.ts.map +1 -0
- package/dist/adapters/references/reach.io.js +14 -0
- package/dist/adapters/references/reach.io.js.map +1 -0
- package/dist/build-engine.d.ts.map +1 -1
- package/dist/build-engine.js +6 -2
- package/dist/build-engine.js.map +1 -1
- package/dist/build.d.ts +15 -0
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +60 -7
- package/dist/build.js.map +1 -1
- package/dist/cli.d.ts +94 -30
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +500 -288
- package/dist/cli.js.map +1 -1
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +40 -72
- package/dist/doctor.js.map +1 -1
- package/dist/engine.d.ts +9 -0
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +27 -0
- package/dist/engine.js.map +1 -1
- package/dist/facts-file.d.ts +2 -2
- package/dist/facts-file.js +2 -2
- package/dist/hooks-settings.d.ts +0 -21
- package/dist/hooks-settings.d.ts.map +1 -1
- package/dist/hooks-settings.js +17 -135
- package/dist/hooks-settings.js.map +1 -1
- package/dist/init.d.ts +39 -29
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +144 -173
- package/dist/init.js.map +1 -1
- package/dist/link-skills.d.ts +1 -1
- package/dist/link-skills.d.ts.map +1 -1
- package/dist/link-skills.js +11 -29
- package/dist/link-skills.js.map +1 -1
- package/dist/new-paper.d.ts +8 -1
- package/dist/new-paper.d.ts.map +1 -1
- package/dist/new-paper.js +49 -25
- package/dist/new-paper.js.map +1 -1
- package/dist/paper-files.d.ts +85 -0
- package/dist/paper-files.d.ts.map +1 -0
- package/dist/paper-files.js +96 -0
- package/dist/paper-files.js.map +1 -0
- package/dist/paper-settings.d.ts +13 -41
- package/dist/paper-settings.d.ts.map +1 -1
- package/dist/paper-settings.js +71 -71
- package/dist/paper-settings.js.map +1 -1
- package/dist/ports/check-references.d.ts +31 -0
- package/dist/ports/check-references.d.ts.map +1 -0
- package/dist/ports/check-references.js +7 -0
- package/dist/ports/check-references.js.map +1 -0
- package/dist/presets.d.ts +1 -1
- package/dist/presets.d.ts.map +1 -1
- package/dist/presets.js +4 -6
- package/dist/presets.js.map +1 -1
- package/dist/reference-rules.d.ts +47 -0
- package/dist/reference-rules.d.ts.map +1 -0
- package/dist/reference-rules.js +156 -0
- package/dist/reference-rules.js.map +1 -0
- package/dist/references.d.ts +36 -0
- package/dist/references.d.ts.map +1 -0
- package/dist/references.js +91 -0
- package/dist/references.js.map +1 -0
- package/dist/rules-config.d.ts +5 -3
- package/dist/rules-config.d.ts.map +1 -1
- package/dist/rules-config.js +15 -6
- package/dist/rules-config.js.map +1 -1
- package/dist/structure.js +3 -3
- package/dist/structure.js.map +1 -1
- package/dist/tex-requirements.js +2 -2
- package/dist/tex-requirements.js.map +1 -1
- package/dist/toolchain.d.ts +5 -1
- package/dist/toolchain.d.ts.map +1 -1
- package/dist/toolchain.js +22 -5
- package/dist/toolchain.js.map +1 -1
- package/dist/types.d.ts +26 -18
- package/dist/types.d.ts.map +1 -1
- package/dist/venue-rules.d.ts.map +1 -1
- package/dist/venue-rules.js +12 -10
- package/dist/venue-rules.js.map +1 -1
- package/docs/configuration.md +163 -104
- package/docs/e2e.md +1 -1
- package/docs/install.md +25 -40
- package/docs/optional-rules.md +5 -4
- package/docs/rules.md +65 -24
- package/docs/skills.md +80 -0
- package/eslint-rules/bib-reachable-entry.mjs +75 -0
- package/eslint-rules/latex-language.mjs +29 -1
- package/eslint-rules/paper-stages.harness.mjs +1 -117
- package/eslint-rules/paper-stages.mjs +0 -120
- package/eslint-rules/paper-stages.mutations.mjs +0 -76
- package/eslint-rules/paper-typography.mjs +306 -191
- package/eslint-rules/paper-typography.test.mjs +337 -0
- package/eslint-rules/papers.harness.mjs +8 -12
- package/eslint-rules/papers.mjs +17 -31
- package/eslint-rules/pdf-last-page-balance.mjs +4 -7
- package/eslint-rules/review-frontmatter.mjs +118 -0
- package/eslint-rules/review-frontmatter.schema.json +36 -0
- package/eslint-rules/review-frontmatter.test.mjs +118 -0
- package/eslint-rules/sibling-frontmatter.mjs +19 -0
- package/eslint-rules/sibling-frontmatter.schema.json +14 -0
- package/eslint.config.mjs +0 -15
- package/fixtures/real-markdown-paper/baseline.json +6 -7
- package/fixtures/toolchain-mirror/catalog.txt +1 -0
- package/fixtures/toolchain-mirror/install-tl +4 -1
- package/fixtures/toolchain-mirror/stub-fmtutil-sys +4 -0
- package/fixtures/toolchain-mirror/stub-tlmgr +15 -0
- package/hooks/hooks.harness.mjs +39 -98
- package/hooks/hooks.mutations.mjs +6 -6
- package/hooks/paper-edit-guard.hook.d.mts +2 -3
- package/hooks/paper-edit-guard.hook.mjs +31 -42
- package/hooks/paper-skills-nudge.hook.mjs +21 -19
- package/hooks/paper-status-gates.hook.mjs +21 -19
- package/hooks/paper-status-gates.sh +8 -13
- package/lib/paper-config.d.mts +15 -25
- package/lib/paper-config.harness.mjs +18 -35
- package/lib/paper-config.mjs +83 -105
- package/lib/paper-config.mutations.mjs +2 -2
- package/lib/skill-checks.mjs +1 -1
- package/lib/skill-trigger-cases.harness.mjs +9 -8
- package/lib/skill-trigger-cases.mjs +7 -15
- package/package.json +1 -1
- package/scripts/eslint-report-guard.mjs +1 -1
- package/scripts/harness-api.frozen.json +0 -3
- package/scripts/mutation-batteries.frozen.json +5 -14
- package/skills/analyze-sibling-paper/SKILL.md +16 -12
- package/skills/analyze-sibling-paper/SKILL.md.spec.ts +15 -11
- package/skills/cold-read-diff/SKILL.md +20 -1
- package/skills/cold-read-diff/SKILL.md.spec.ts +19 -0
- package/skills/grade-paper-writing/SKILL.md +20 -1
- package/skills/grade-paper-writing/SKILL.md.spec.ts +19 -0
- package/skills/paper-pipeline/scripts/consumer.d.mts +0 -1
- package/skills/paper-pipeline/scripts/consumer.harness.mjs +8 -12
- package/skills/paper-pipeline/scripts/consumer.mjs +19 -33
- package/skills/paper-pipeline/scripts/extract-ref-facts.harness.mjs +6 -4
- package/skills/paper-pipeline/scripts/run-mechanical.mjs +2 -11
- package/skills/plan-paper-timeline/SKILL.md +2 -2
- package/skills/plan-paper-timeline/SKILL.md.spec.ts +1 -1
- package/skills/plan-paper-timeline/plan-paper-timeline.effects.harness.mjs +1 -1
- package/skills/plan-paper-timeline/plan-paper-timeline.effects.mutations.mjs +2 -2
- package/skills/render-paper/check-render.sh +2 -3
- package/skills/render-paper/render-paper.harness.mjs +2 -2
- package/skills/verify-citations/SKILL.md +10 -1
- package/skills/verify-citations/SKILL.md.spec.ts +9 -0
- package/skills/verify-citations/scripts/bib-authors.mjs +48 -26
- package/src/adapters/references/index.ts +102 -0
- package/src/adapters/references/reach.io.ts +12 -0
- package/src/build-engine.ts +6 -1
- package/src/build.harness.mjs +54 -6
- package/src/build.ts +89 -11
- package/src/cli.harness.mjs +149 -294
- package/src/cli.mutations.mjs +35 -44
- package/src/cli.ts +637 -328
- package/src/doctor.harness.mjs +41 -84
- package/src/doctor.mutations.mjs +9 -9
- package/src/doctor.ts +44 -89
- package/src/engine.harness.mjs +50 -0
- package/src/engine.ts +35 -0
- package/src/facts-file.test.ts +0 -7
- package/src/facts-file.ts +2 -2
- package/src/hooks-settings.harness.mjs +7 -92
- package/src/hooks-settings.mutations.mjs +2 -17
- package/src/hooks-settings.ts +18 -162
- package/src/init.test.ts +206 -0
- package/src/init.ts +187 -231
- package/src/link-skills.harness.mjs +1 -38
- package/src/link-skills.mutations.mjs +9 -5
- package/src/link-skills.ts +10 -34
- package/src/lint-fix.test.ts +120 -0
- package/src/linted-set.test.ts +118 -0
- package/src/new-paper.harness.mjs +2 -0
- package/src/new-paper.mutations.mjs +0 -14
- package/src/new-paper.test.ts +173 -14
- package/src/new-paper.ts +82 -30
- package/src/paper-files.test.ts +395 -0
- package/src/paper-files.ts +200 -0
- package/src/paper-settings-commands.test.ts +121 -122
- package/src/paper-settings.test.ts +93 -64
- package/src/paper-settings.ts +99 -97
- package/src/parse-args.test.ts +48 -0
- package/src/ports/check-references.ts +28 -0
- package/src/presets.ts +5 -15
- package/src/reference-rules.ts +229 -0
- package/src/references.test.ts +209 -0
- package/src/references.ts +138 -0
- package/src/rules-config.harness.mjs +24 -8
- package/src/rules-config.ts +19 -7
- package/src/rules-off.test.ts +111 -0
- package/src/structure.harness.mjs +4 -2
- package/src/structure.ts +3 -3
- package/src/tex-requirements.ts +2 -2
- package/src/toolchain.harness.mjs +41 -6
- package/src/toolchain.ts +29 -5
- package/src/types.ts +36 -18
- package/src/venue-rules.test.ts +23 -11
- package/src/venue-rules.ts +12 -14
- package/templates/paper/paperlint.json +1 -1
- package/eslint-rules/doc-fields.harness.mjs +0 -336
- package/eslint-rules/doc-fields.mjs +0 -186
- package/eslint-rules/doc-fields.mutations.mjs +0 -96
- package/eslint-rules/paper-typography.harness.mjs +0 -291
- package/eslint-rules/paper-typography.mutations.mjs +0 -131
- package/eslint-rules/review-findings-cause.harness.mjs +0 -228
- package/eslint-rules/review-findings-cause.mjs +0 -135
- package/eslint-rules/review-findings-cause.mutations.mjs +0 -72
- package/fixtures/paper-stages/authors-ran/PIPELINE-STATUS.md +0 -16
- package/fixtures/paper-stages/marker-in-prose/PIPELINE-STATUS.md +0 -17
- package/fixtures/review-findings-cause/clean.md +0 -17
- package/fixtures/review-findings-cause/defect.md +0 -14
- package/fixtures/review-findings-cause/old-debt.md +0 -14
- package/fixtures/review-findings-cause/quiet-in-fence.md +0 -16
package/dist/link-skills.js
CHANGED
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
* elsewhere, a dangling link — is someone else's, and is reported, not replaced.
|
|
28
28
|
*/
|
|
29
29
|
/* eslint-disable boundaries/dependencies -- legacy I/O, moves behind a port in #76 */
|
|
30
|
-
import { existsSync, lstatSync, mkdirSync, readlinkSync, realpathSync, symlinkSync,
|
|
30
|
+
import { existsSync, lstatSync, mkdirSync, readlinkSync, realpathSync, symlinkSync, } from "node:fs";
|
|
31
31
|
/* eslint-enable boundaries/dependencies */
|
|
32
32
|
import { createRequire } from "node:module";
|
|
33
|
-
import { dirname, join, relative, resolve
|
|
33
|
+
import { dirname, join, relative, resolve } from "node:path";
|
|
34
34
|
import { pathToFileURL } from "node:url";
|
|
35
|
-
import { installedSkills,
|
|
35
|
+
import { installedSkills, PACKAGE_NAME, SHIPPED_SKILLS_DIR, } from "../skills/paper-pipeline/scripts/consumer.mjs";
|
|
36
36
|
export { PACKAGE_NAME };
|
|
37
37
|
/** Where Claude Code looks for project skills, relative to the project root. */
|
|
38
38
|
export const SKILLS_HOME = join(".claude", "skills");
|
|
@@ -87,12 +87,8 @@ export function shippedSkills(pkgDir) {
|
|
|
87
87
|
return { error: e.message };
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
/**
|
|
91
|
-
|
|
92
|
-
* an install under the package's old name wrote it (`legacyTarget`) is `stale`: ours, from before
|
|
93
|
-
* the rename, and replaced on the next `init`.
|
|
94
|
-
*/
|
|
95
|
-
function inspect(entry, want, legacyTarget) {
|
|
90
|
+
/** What occupies `entry`, judged against the directory it should lead to. */
|
|
91
|
+
function inspect(entry, want) {
|
|
96
92
|
let st;
|
|
97
93
|
try {
|
|
98
94
|
st = lstatSync(entry);
|
|
@@ -100,11 +96,6 @@ function inspect(entry, want, legacyTarget) {
|
|
|
100
96
|
catch {
|
|
101
97
|
return { status: "missing" };
|
|
102
98
|
}
|
|
103
|
-
if (st.isSymbolicLink() && readlinkSync(entry) === legacyTarget)
|
|
104
|
-
return {
|
|
105
|
-
status: "stale",
|
|
106
|
-
reason: `a link into ${LEGACY_PACKAGE_NAME}, the package's old name — \`npx ${PACKAGE_NAME} init\` replaces it`,
|
|
107
|
-
};
|
|
108
99
|
try {
|
|
109
100
|
if (realpathSync(entry) === want)
|
|
110
101
|
return { status: "present" };
|
|
@@ -124,25 +115,16 @@ function inspect(entry, want, legacyTarget) {
|
|
|
124
115
|
reason: st.isDirectory() ? "a directory" : "a file",
|
|
125
116
|
};
|
|
126
117
|
}
|
|
127
|
-
/**
|
|
128
|
-
* One skill: inspect its entry and, when writing, create the link — or replace one an install
|
|
129
|
-
* under the package's old name made.
|
|
130
|
-
*/
|
|
118
|
+
/** One skill: inspect its entry and, when writing, create the link. */
|
|
131
119
|
function linkOne(name, { entry, target, want, write, }) {
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
const fixable = seen.status === "missing" || seen.status === "stale";
|
|
135
|
-
if (!write || !fixable) {
|
|
136
|
-
const status = seen.status === "stale" ? "foreign" : seen.status;
|
|
120
|
+
const seen = inspect(entry, want);
|
|
121
|
+
if (!write || seen.status !== "missing")
|
|
137
122
|
return seen.reason
|
|
138
|
-
? { name, status, reason: seen.reason }
|
|
139
|
-
: { name, status };
|
|
140
|
-
}
|
|
123
|
+
? { name, status: seen.status, reason: seen.reason }
|
|
124
|
+
: { name, status: seen.status };
|
|
141
125
|
try {
|
|
142
|
-
if (seen.status === "stale")
|
|
143
|
-
unlinkSync(entry);
|
|
144
126
|
symlinkSync(target, entry, "dir");
|
|
145
|
-
return { name, status:
|
|
127
|
+
return { name, status: "created" };
|
|
146
128
|
}
|
|
147
129
|
catch (e) {
|
|
148
130
|
return {
|
package/dist/link-skills.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link-skills.js","sourceRoot":"","sources":["../src/link-skills.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,sFAAsF;AACtF,OAAO,EACL,UAAU,EACV,SAAS,EACT,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,WAAW,
|
|
1
|
+
{"version":3,"file":"link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AAC;IACH,CAAC;IACD,4FAA4F;IAC5F,kEAAkE;IAClE,MAAM,YAAY,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3E,IAAI,OAAO,GAAkB,IAAI,CAAC;IAClC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAa,EAAE;QAClD,MAAM,MAAM,GAAG,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC;QACjE,OAAO,KAAK,MAAM,CAAC;QACnB,OAAO,OAAO,CAAC,IAAI,EAAE;YACnB,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC;YACvB,MAAM;YACN,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;YACjD,KAAK;SACN,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAC5C,CAAC"}
|
package/dist/new-paper.d.ts
CHANGED
|
@@ -40,8 +40,15 @@ export type NewPaperResult = {
|
|
|
40
40
|
* already has a source in EITHER format, in which case that one stands — and `paperlint.json`.
|
|
41
41
|
*/
|
|
42
42
|
export declare function wantedFiles(dir: string, format: PaperFormat): string[];
|
|
43
|
-
|
|
43
|
+
/** The venue `paperlint new --venue` chose: what goes into the new paper's `paperlint.json`. */
|
|
44
|
+
export interface VenueSetting {
|
|
45
|
+
/** `paperlint:<name>`, or a path relative to the paper's `paperlint.json`. */
|
|
46
|
+
readonly extends: string;
|
|
47
|
+
readonly kind: string | null;
|
|
48
|
+
}
|
|
49
|
+
export declare function newPaper(papersRoot: string, name: string, format: PaperFormat, { packageTemplates, venue, }?: {
|
|
44
50
|
packageTemplates?: string;
|
|
51
|
+
venue?: VenueSetting | null;
|
|
45
52
|
}): NewPaperResult;
|
|
46
53
|
/** The report lines, shared by `paperlint new` and the first-paper offer in `paperlint init`. */
|
|
47
54
|
export declare function reportNewPaper(result: NewPaperResult, here: (p: string) => string): string[];
|
package/dist/new-paper.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new-paper.d.ts","sourceRoot":"","sources":["../src/new-paper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"new-paper.d.ts","sourceRoot":"","sources":["../src/new-paper.ts"],"names":[],"mappings":"AA6BA,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,IAAI,CAAC;AACvC,eAAO,MAAM,OAAO,EAAE,SAAS,WAAW,EAAkB,CAAC;AAC7D,eAAO,MAAM,cAAc,EAAE,WAAmB,CAAC;AAEjD,8FAA8F;AAC9F,eAAO,MAAM,iBAAiB,QAE7B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,cAAc,CAAC;AAExC,eAAO,MAAM,WAAW,uBAAuB,CAAC;AAChD,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAG7D,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,GAAG,OAAO,KAAG,CAAC,IAAI,WACP,CAAC;AAErC;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMvD;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAAC;IACpC,uDAAuD;IACvD,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACvC;AAED,MAAM,MAAM,cAAc,GACtB;IACE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAClB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,CAAC;CACxC,GACD;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,MAAM,EAAE,CAEtE;AASD,gGAAgG;AAChG,MAAM,WAAW,YAAY;IAC3B,8EAA8E;IAC9E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAkED,wBAAgB,QAAQ,CACtB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,WAAW,EACnB,EACE,gBAAoC,EACpC,KAAY,GACb,GAAE;IAAE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,YAAY,GAAG,IAAI,CAAA;CAAO,GACjE,cAAc,CAgChB;AAED,iGAAiG;AACjG,wBAAgB,cAAc,CAC5B,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,GAC1B,MAAM,EAAE,CAYV"}
|
package/dist/new-paper.js
CHANGED
|
@@ -19,7 +19,7 @@ import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync, } from "n
|
|
|
19
19
|
/* eslint-enable boundaries/dependencies */
|
|
20
20
|
import { join } from "node:path";
|
|
21
21
|
import { fileURLToPath } from "node:url";
|
|
22
|
-
import {
|
|
22
|
+
import { CONFIG_FILE } from "../lib/paper-config.mjs";
|
|
23
23
|
export const FORMATS = ["tex", "md"];
|
|
24
24
|
export const DEFAULT_FORMAT = "tex";
|
|
25
25
|
/** The package's default templates. Read from disk, so they ship in the tarball (`files`). */
|
|
@@ -53,25 +53,53 @@ export function nameProblem(name) {
|
|
|
53
53
|
* already has a source in EITHER format, in which case that one stands — and `paperlint.json`.
|
|
54
54
|
*/
|
|
55
55
|
export function wantedFiles(dir, format) {
|
|
56
|
-
return [...scorecardAndSource(dir, format),
|
|
56
|
+
return [...scorecardAndSource(dir, format), CONFIG_FILE];
|
|
57
57
|
}
|
|
58
58
|
function scorecardAndSource(dir, format) {
|
|
59
59
|
const hasSource = Object.values(SOURCE_FILE).some((f) => existsSync(join(dir, f)));
|
|
60
60
|
return hasSource ? [STATUS_FILE] : [STATUS_FILE, SOURCE_FILE[format]];
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
|
-
* `paperlint.json
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* refuse.
|
|
63
|
+
* The template's `paperlint.json` with the chosen venue written in. The template's `$comment`
|
|
64
|
+
* explains how to choose one, so it goes once one is chosen. A template that is not plain JSON (a
|
|
65
|
+
* project's own, with comments) cannot be edited safely and is refused by name.
|
|
67
66
|
*/
|
|
68
|
-
function
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
function withVenue(text, src, venue) {
|
|
68
|
+
let obj;
|
|
69
|
+
try {
|
|
70
|
+
obj = JSON.parse(text);
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return {
|
|
74
|
+
ok: false,
|
|
75
|
+
reason: `--venue cannot be written into ${src}: it is not plain JSON — set "extends" by hand`,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
const out = { ...obj, extends: venue.extends };
|
|
79
|
+
delete out["$comment"];
|
|
80
|
+
if (venue.kind !== null)
|
|
81
|
+
out["kind"] = venue.kind;
|
|
82
|
+
return { ok: true, text: `${JSON.stringify(out, null, 2)}\n` };
|
|
83
|
+
}
|
|
84
|
+
/** One file's text from its template — the project's override first, the package's second. */
|
|
85
|
+
function fromTemplate(file, { papersRoot, packageTemplates, name, venue, }) {
|
|
86
|
+
const project = join(papersRoot, OVERRIDE_DIR, file);
|
|
87
|
+
const [src, from] = existsSync(project)
|
|
88
|
+
? [project, "project"]
|
|
89
|
+
: [join(packageTemplates, file), "package"];
|
|
90
|
+
// A missing package template is a broken install, not a reason to write an empty file.
|
|
91
|
+
if (!existsSync(src))
|
|
92
|
+
return { ok: false, reason: `no template for ${file}: ${src} is missing` };
|
|
93
|
+
const text = readFileSync(src, "utf8").split("{{name}}").join(name);
|
|
94
|
+
if (file !== CONFIG_FILE || venue === null)
|
|
95
|
+
return { ok: true, value: { file, text, from } };
|
|
96
|
+
const edited = withVenue(text, src, venue);
|
|
97
|
+
return edited.ok
|
|
98
|
+
? { ok: true, value: { file, text: edited.text, from } }
|
|
99
|
+
: edited;
|
|
72
100
|
}
|
|
73
|
-
// Documented in README.md#
|
|
74
|
-
export function newPaper(papersRoot, name, format, { packageTemplates = PACKAGE_TEMPLATES } = {}) {
|
|
101
|
+
// Documented in README.md#getting-started — update it when this changes.
|
|
102
|
+
export function newPaper(papersRoot, name, format, { packageTemplates = PACKAGE_TEMPLATES, venue = null, } = {}) {
|
|
75
103
|
const problem = nameProblem(name);
|
|
76
104
|
if (problem)
|
|
77
105
|
return { ok: false, reason: problem };
|
|
@@ -86,19 +114,15 @@ export function newPaper(papersRoot, name, format, { packageTemplates = PACKAGE_
|
|
|
86
114
|
files.push({ file, status: "kept" });
|
|
87
115
|
continue;
|
|
88
116
|
}
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (!
|
|
96
|
-
return
|
|
97
|
-
|
|
98
|
-
reason: `no template for ${file}: ${src} is missing`,
|
|
99
|
-
};
|
|
100
|
-
const text = readFileSync(src, "utf8").split("{{name}}").join(name);
|
|
101
|
-
toWrite.push({ file, text, from });
|
|
117
|
+
const planned = fromTemplate(file, {
|
|
118
|
+
papersRoot,
|
|
119
|
+
packageTemplates,
|
|
120
|
+
name,
|
|
121
|
+
venue,
|
|
122
|
+
});
|
|
123
|
+
if (!planned.ok)
|
|
124
|
+
return planned;
|
|
125
|
+
toWrite.push(planned.value);
|
|
102
126
|
}
|
|
103
127
|
// Read every template before writing any file, so a missing one leaves no half-made folder.
|
|
104
128
|
mkdirSync(dir, { recursive: true });
|
package/dist/new-paper.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new-paper.js","sourceRoot":"","sources":["../src/new-paper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,sFAAsF;AACtF,OAAO,EACL,UAAU,EACV,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,2CAA2C;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,
|
|
1
|
+
{"version":3,"file":"new-paper.js","sourceRoot":"","sources":["../src/new-paper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,sFAAsF;AACtF,OAAO,EACL,UAAU,EACV,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,2CAA2C;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGtD,MAAM,CAAC,MAAM,OAAO,GAA2B,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AAC7D,MAAM,CAAC,MAAM,cAAc,GAAgB,KAAK,CAAC;AAEjD,8FAA8F;AAC9F,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAC5C,IAAI,GAAG,CAAC,qBAAqB,EAAE,MAAM,CAAC,IAAI,CAA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,MAAM,CAAC,GAAG,CAAC,EAAE;KACrG,CAAC;IACF,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,KAAK;QAC1B,GAAG,CAAC,IAAI,CACN,CAAC,CAAC,MAAM,KAAK,SAAS;YACpB,CAAC,CAAC,WAAW,CAAC,CAAC,IAAI,eAAe,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,aAAa,YAAY,GAAG,CAAC,CAAC,CAAC,SAAS,YAAY;YAC7G,CAAC,CAAC,WAAW,CAAC,CAAC,IAAI,8BAA8B,CACpD,CAAC;IACJ,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE FILES PAPERLINT OWNS — read off its own config, and made the only thing ESLint may reach.
|
|
3
|
+
*
|
|
4
|
+
* paperlint's blocks name the files they lint (`PIPELINE-STATUS.md`, `paper.md`, `paper.tex`,
|
|
5
|
+
* `reviews/*.md`, …). That list is the whole scope of `paperlint lint`, and this module turns it
|
|
6
|
+
* into two things ESLint understands:
|
|
7
|
+
*
|
|
8
|
+
* 1. **A global ignore of everything else** (`scopeToOwned`). Handing ESLint a directory is not
|
|
9
|
+
* enough: its built-in defaults lint every JavaScript file it finds, whatever our config says.
|
|
10
|
+
* Measured on a consumer project with vendored code under a paper's `repro/` folder: 1,877
|
|
11
|
+
* files, 74 errors ("'return' outside of function", "Definition for rule … was not found"),
|
|
12
|
+
* zero of them on a paper file, exit 1 — and nothing in the settings could turn it off. With
|
|
13
|
+
* the ignore, a stray script under the papers directory is never enumerated at all, and a file
|
|
14
|
+
* named on the command line can be asked about (`ESLint#isPathIgnored`) with ESLint's own
|
|
15
|
+
* matcher instead of a hand-written one.
|
|
16
|
+
*
|
|
17
|
+
* 2. **Each rule scoped to the files it was written for** (`ruleOwners` + `narrowToOwners`).
|
|
18
|
+
* One plugin NAME is bound to different plugin objects in different blocks: `paper` holds
|
|
19
|
+
* `stages`/`source`/`author-list` beside `PIPELINE-STATUS.md` and `research-question`/
|
|
20
|
+
* `typography` beside `paper.md`/`paper.tex`. So a consumer block that named `paper/source`
|
|
21
|
+
* for every file under the papers directory reached `paper.tex`, where `paper` has no `source`
|
|
22
|
+
* — and ESLint threw `Could not find "source" in plugin "paper"` from inside `lintFiles`,
|
|
23
|
+
* after paperlint's own validation had (correctly) accepted the id. A block is therefore split
|
|
24
|
+
* per owner and its `files` ANDed with the owner's (ESLint's nested-array form), so a rule can
|
|
25
|
+
* only land where its plugin is registered.
|
|
26
|
+
*
|
|
27
|
+
* Both read ONE definition of "the files paperlint lints": `ownedScopes`, each own block's `files`
|
|
28
|
+
* together with its `ignores`. The globs alone are not that definition. The sibling-card block
|
|
29
|
+
* claims every markdown file under `siblings/` EXCEPT the index, and a rule whose plugin is
|
|
30
|
+
* registered for every file (`pdf`) used to keep the consumer block's `files` as they were — so a
|
|
31
|
+
* venue preset's rules reached `siblings/README.md`, a block with no `language` matched it, and
|
|
32
|
+
* ESLint parsed the markdown as JavaScript (#101). Now every generated block narrows to scopes,
|
|
33
|
+
* exceptions included, and a plugin registered everywhere owns exactly what paperlint lints.
|
|
34
|
+
*
|
|
35
|
+
* ESLint's semantics that this leans on, each measured against ESLint 10 before writing it:
|
|
36
|
+
* - a global-ignore pattern that matches a DIRECTORY hides everything inside it, so directories
|
|
37
|
+
* must be un-ignored (`!` + a pattern ending in a slash) before owned files can be;
|
|
38
|
+
* - that un-ignores `node_modules/` and `.git/` too — ESLint's own defaults — so they are
|
|
39
|
+
* re-ignored after, or a `paper.md` inside a dependency would be linted;
|
|
40
|
+
* - later global-ignore patterns win, across blocks, in config order;
|
|
41
|
+
* - `files: [["a", "b"]]` matches a file only when BOTH patterns match.
|
|
42
|
+
*/
|
|
43
|
+
import type { RuleBlock, RuleEntry } from "./rules-config.ts";
|
|
44
|
+
/**
|
|
45
|
+
* A set of files paperlint lints: an own block's globs and the exceptions that block makes. A file is
|
|
46
|
+
* in it when it matches one of `files` and none of `ignores`.
|
|
47
|
+
*/
|
|
48
|
+
export interface OwnedScope {
|
|
49
|
+
readonly files: readonly string[];
|
|
50
|
+
readonly ignores: readonly string[];
|
|
51
|
+
}
|
|
52
|
+
/** A `files` entry: one glob, or several that must ALL match. */
|
|
53
|
+
export type FilesEntry = string | readonly string[];
|
|
54
|
+
/** A consumer block after narrowing: its `files` may carry ANDed pairs. */
|
|
55
|
+
export interface ScopedBlock {
|
|
56
|
+
readonly basePath: string;
|
|
57
|
+
readonly files?: readonly FilesEntry[];
|
|
58
|
+
readonly ignores?: readonly string[];
|
|
59
|
+
readonly rules: Readonly<Record<string, RuleEntry>>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* THE FILES PAPERLINT LINTS: every own block that names `files`, with its `ignores`. A block without
|
|
63
|
+
* `files` (a global ignore, or the block registering `pdf` for every file) claims nothing.
|
|
64
|
+
*/
|
|
65
|
+
export declare function ownedScopes(own: readonly unknown[]): OwnedScope[];
|
|
66
|
+
/** Every glob paperlint's own blocks lint, once, in config order. */
|
|
67
|
+
export declare function ownedPatterns(own: readonly unknown[]): string[];
|
|
68
|
+
/** A global-ignore block that leaves ESLint nothing to lint but `owned`. */
|
|
69
|
+
export declare function scopeToOwned(owned: readonly string[]): {
|
|
70
|
+
readonly ignores: string[];
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Rule id → the scopes of the blocks that register its plugin with that rule. A plugin registered
|
|
74
|
+
* for every file (a block without `files`) owns every scope — everything paperlint lints, and not
|
|
75
|
+
* one file more.
|
|
76
|
+
*/
|
|
77
|
+
export declare function ruleOwners(own: readonly unknown[]): Map<string, readonly OwnedScope[]>;
|
|
78
|
+
/**
|
|
79
|
+
* One consumer block → one block per owner scope, each carrying only that owner's rules, its `files`
|
|
80
|
+
* ANDed with the scope's globs and its `ignores` joined by the scope's exceptions. A rule no block
|
|
81
|
+
* of this config registers (the LaTeX block is absent when its parser did not load) gets no block:
|
|
82
|
+
* it has no file to reach in this run, and naming it to ESLint would only crash.
|
|
83
|
+
*/
|
|
84
|
+
export declare function narrowToOwners(block: RuleBlock, owners: ReadonlyMap<string, readonly OwnedScope[]>): ScopedBlock[];
|
|
85
|
+
//# sourceMappingURL=paper-files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paper-files.d.ts","sourceRoot":"","sources":["../src/paper-files.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAW9D;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAED,iEAAiE;AACjE,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;AAEpD,2EAA2E;AAC3E,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IACvC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;CACrD;AAyBD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,SAAS,OAAO,EAAE,GAAG,UAAU,EAAE,CAOjE;AAED,qEAAqE;AACrE,wBAAgB,aAAa,CAAC,GAAG,EAAE,SAAS,OAAO,EAAE,GAAG,MAAM,EAAE,CAE/D;AAKD,4EAA4E;AAC5E,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG;IACtD,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;CAC5B,CASA;AAQD;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,GAAG,EAAE,SAAS,OAAO,EAAE,GACtB,GAAG,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC,CAapC;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC,GACjD,WAAW,EAAE,CAaf"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
const globsOf = (b) => (b.files ?? []).filter((f) => typeof f === "string");
|
|
2
|
+
const stringsOf = (xs) => (xs ?? []).filter((x) => typeof x === "string");
|
|
3
|
+
/**
|
|
4
|
+
* Scopes with the same exceptions, merged into one: their globs united, once, in order. Keeps a
|
|
5
|
+
* generated block per distinct set of exceptions rather than one per own block.
|
|
6
|
+
*/
|
|
7
|
+
const merged = (scopes) => {
|
|
8
|
+
const byIgnores = new Map();
|
|
9
|
+
for (const s of scopes) {
|
|
10
|
+
const key = JSON.stringify(s.ignores);
|
|
11
|
+
const had = byIgnores.get(key);
|
|
12
|
+
byIgnores.set(key, {
|
|
13
|
+
files: [...new Set([...(had?.files ?? []), ...s.files])],
|
|
14
|
+
ignores: s.ignores,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return [...byIgnores.values()];
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* THE FILES PAPERLINT LINTS: every own block that names `files`, with its `ignores`. A block without
|
|
21
|
+
* `files` (a global ignore, or the block registering `pdf` for every file) claims nothing.
|
|
22
|
+
*/
|
|
23
|
+
export function ownedScopes(own) {
|
|
24
|
+
return merged(own
|
|
25
|
+
.map((raw) => raw)
|
|
26
|
+
.filter((b) => b.files !== undefined)
|
|
27
|
+
.map((b) => ({ files: globsOf(b), ignores: stringsOf(b.ignores) })));
|
|
28
|
+
}
|
|
29
|
+
/** Every glob paperlint's own blocks lint, once, in config order. */
|
|
30
|
+
export function ownedPatterns(own) {
|
|
31
|
+
return [...new Set(ownedScopes(own).flatMap((s) => s.files))];
|
|
32
|
+
}
|
|
33
|
+
/** ESLint's default ignores, re-applied after directories are un-ignored. */
|
|
34
|
+
const ESLINT_DEFAULT_IGNORES = ["**/node_modules/", "**/.git/"];
|
|
35
|
+
/** A global-ignore block that leaves ESLint nothing to lint but `owned`. */
|
|
36
|
+
export function scopeToOwned(owned) {
|
|
37
|
+
return {
|
|
38
|
+
ignores: [
|
|
39
|
+
"**/*",
|
|
40
|
+
"!**/*/",
|
|
41
|
+
...owned.map((p) => `!${p}`),
|
|
42
|
+
...ESLINT_DEFAULT_IGNORES,
|
|
43
|
+
],
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/** Every `<plugin>/<rule>` a block registers. */
|
|
47
|
+
const ruleIdsOf = (b) => Object.entries(b.plugins ?? {}).flatMap(([name, plugin]) => Object.keys(plugin.rules ?? {}).map((rule) => `${name}/${rule}`));
|
|
48
|
+
/**
|
|
49
|
+
* Rule id → the scopes of the blocks that register its plugin with that rule. A plugin registered
|
|
50
|
+
* for every file (a block without `files`) owns every scope — everything paperlint lints, and not
|
|
51
|
+
* one file more.
|
|
52
|
+
*/
|
|
53
|
+
export function ruleOwners(own) {
|
|
54
|
+
const all = ownedScopes(own);
|
|
55
|
+
const found = new Map();
|
|
56
|
+
for (const raw of own) {
|
|
57
|
+
const b = raw;
|
|
58
|
+
const scopes = b.files === undefined
|
|
59
|
+
? all
|
|
60
|
+
: [{ files: globsOf(b), ignores: stringsOf(b.ignores) }];
|
|
61
|
+
for (const id of ruleIdsOf(b))
|
|
62
|
+
found.set(id, [...(found.get(id) ?? []), ...scopes]);
|
|
63
|
+
}
|
|
64
|
+
return new Map([...found].map(([id, scopes]) => [id, merged(scopes)]));
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* One consumer block → one block per owner scope, each carrying only that owner's rules, its `files`
|
|
68
|
+
* ANDed with the scope's globs and its `ignores` joined by the scope's exceptions. A rule no block
|
|
69
|
+
* of this config registers (the LaTeX block is absent when its parser did not load) gets no block:
|
|
70
|
+
* it has no file to reach in this run, and naming it to ESLint would only crash.
|
|
71
|
+
*/
|
|
72
|
+
export function narrowToOwners(block, owners) {
|
|
73
|
+
const groups = new Map();
|
|
74
|
+
for (const [id, entry] of Object.entries(block.rules)) {
|
|
75
|
+
const owner = owners.get(id);
|
|
76
|
+
if (owner === undefined)
|
|
77
|
+
continue;
|
|
78
|
+
const key = JSON.stringify(owner);
|
|
79
|
+
groups.set(key, { ...groups.get(key), [id]: entry });
|
|
80
|
+
}
|
|
81
|
+
return [...groups].flatMap(([key, rules]) => JSON.parse(key).map((scope) => within(block, scope, rules)));
|
|
82
|
+
}
|
|
83
|
+
/** `block`'s rules over the files both it and `scope` claim, minus both sets of exceptions. */
|
|
84
|
+
function within(block, scope, rules) {
|
|
85
|
+
const files = block.files
|
|
86
|
+
? block.files.flatMap((f) => scope.files.map((o) => [f, o]))
|
|
87
|
+
: scope.files;
|
|
88
|
+
const ignores = [...(block.ignores ?? []), ...scope.ignores];
|
|
89
|
+
return {
|
|
90
|
+
basePath: block.basePath,
|
|
91
|
+
files,
|
|
92
|
+
...(ignores.length ? { ignores } : {}),
|
|
93
|
+
rules,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=paper-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paper-files.js","sourceRoot":"","sources":["../src/paper-files.ts"],"names":[],"mappings":"AAyEA,MAAM,OAAO,GAAG,CAAC,CAAQ,EAAY,EAAE,CACrC,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC;AAEpE,MAAM,SAAS,GAAG,CAAC,EAAkC,EAAY,EAAE,CACjE,CAAC,EAAE,IAAI,EAAE,CAAC,CA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KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAC5B,CACF,CAAC;AACJ,CAAC;AAED,+FAA+F;AAC/F,SAAS,MAAM,CACb,KAAgB,EAChB,KAAiB,EACjB,KAA0C;IAE1C,MAAM,KAAK,GAA0B,KAAK,CAAC,KAAK;QAC9C,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC5D,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;IAChB,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7D,OAAO;QACL,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,KAAK;QACL,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACtC,KAAK;KACN,CAAC;AACJ,CAAC"}
|
package/dist/paper-settings.d.ts
CHANGED
|
@@ -9,60 +9,32 @@ export interface PaperSettings {
|
|
|
9
9
|
readonly kind: string | null;
|
|
10
10
|
/** The built PDF relative to the paper, when it is not `paper.pdf`. */
|
|
11
11
|
readonly pdf: string | null;
|
|
12
|
-
/**
|
|
13
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Rule overrides for this paper alone — `{ id: severity }` or ESLint blocks — NOT yet checked
|
|
14
|
+
* against the shipped rules.
|
|
15
|
+
*/
|
|
16
|
+
readonly rules: Readonly<Record<string, unknown>> | readonly unknown[] | null;
|
|
14
17
|
}
|
|
15
18
|
/** Why a paper's settings cannot be read. */
|
|
16
19
|
export type SettingsProblem = {
|
|
17
20
|
readonly kind: "broken";
|
|
18
21
|
readonly why: string;
|
|
19
|
-
} | {
|
|
20
|
-
readonly kind: "legacy";
|
|
21
22
|
};
|
|
23
|
+
declare const STRING_FIELDS: readonly ["extends", "kind", "pdf"];
|
|
24
|
+
/** `extends`, `kind` and `pdf`, each null when absent. The root file's defaults parse the same way. */
|
|
25
|
+
export declare function stringFields(d: Readonly<Record<string, unknown>>): Result<Pick<PaperSettings, (typeof STRING_FIELDS)[number]>, string>;
|
|
22
26
|
/** The parsed JSON of `paperlint.json` → the settings, or one line saying what is wrong. Pure. */
|
|
23
27
|
export declare function parsePaperSettings(json: unknown): Result<PaperSettings, string>;
|
|
24
28
|
/**
|
|
25
|
-
* A paper's settings
|
|
26
|
-
*
|
|
29
|
+
* A paper's settings, its own `paperlint.json` merged over the root's defaults: null when neither
|
|
30
|
+
* says anything; the problem when a file does not parse. Reads through `files` only; never throws.
|
|
27
31
|
*/
|
|
28
32
|
export declare function readPaperSettings(files: Files, paperDir: string): Result<PaperSettings | null, SettingsProblem>;
|
|
29
|
-
/** What `paperlint init` does with one paper's files. */
|
|
30
|
-
export type Migration =
|
|
31
|
-
/** No `venue.json`: nothing to do. */
|
|
32
|
-
{
|
|
33
|
-
readonly kind: "none";
|
|
34
|
-
}
|
|
35
|
-
/** Only `venue.json`: write `text` as `paperlint.json`, delete `venue.json`. */
|
|
36
|
-
| {
|
|
37
|
-
readonly kind: "move";
|
|
38
|
-
readonly text: string;
|
|
39
|
-
}
|
|
40
|
-
/** Both, and `paperlint.json` already says the same: the old one is a leftover, delete it. */
|
|
41
|
-
| {
|
|
42
|
-
readonly kind: "drop-legacy";
|
|
43
|
-
}
|
|
44
|
-
/** Both, and they differ: refuse — there is no way to know which one the author means. */
|
|
45
|
-
| {
|
|
46
|
-
readonly kind: "conflict";
|
|
47
|
-
}
|
|
48
|
-
/** `venue.json` is not a JSON object: refuse, naming why. */
|
|
49
|
-
| {
|
|
50
|
-
readonly kind: "broken";
|
|
51
|
-
readonly why: string;
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* A `venue.json` object → the `paperlint.json` object that says the same, in one move:
|
|
55
|
-
* `"venue": "aisec"` becomes `"extends": "paperlint:aisec"` (the only presets that existed were the
|
|
56
|
-
* shipped ones), and the `"_"` some files used as a comment becomes `"$comment"`. Every other key
|
|
57
|
-
* is carried as it is — an unknown one is then refused by name, as in any `paperlint.json`. Pure.
|
|
58
|
-
*/
|
|
59
|
-
export declare function fromLegacy(legacy: Readonly<Record<string, unknown>>): Record<string, unknown>;
|
|
60
|
-
/** The move, planned from the two files' bytes (null = absent). Pure. */
|
|
61
|
-
export declare function migrationOf(legacy: Uint8Array | null, current: Uint8Array | null): Migration;
|
|
62
33
|
/**
|
|
63
34
|
* `rules` → the parsed entries (rule id → severity or `[severity, options]`), or the error naming
|
|
64
|
-
* the file. Null when the paper sets none.
|
|
65
|
-
* (`paperRuleBlocks` in cli.ts)
|
|
35
|
+
* the file. Null when the paper sets none. Blocks (the list form) are parsed by the caller, which
|
|
36
|
+
* knows the file globs they are relative to (`paperRuleBlocks` in cli.ts).
|
|
66
37
|
*/
|
|
67
38
|
export declare function paperRules(paperDir: string, settings: PaperSettings, shipped: ReadonlySet<string>): Parsed<Record<string, RuleEntry> | null>;
|
|
39
|
+
export {};
|
|
68
40
|
//# sourceMappingURL=paper-settings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paper-settings.d.ts","sourceRoot":"","sources":["../src/paper-settings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"paper-settings.d.ts","sourceRoot":"","sources":["../src/paper-settings.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAEL,KAAK,MAAM,EACX,KAAK,SAAS,EACf,MAAM,mBAAmB,CAAC;AAE3B,2DAA2D;AAC3D,MAAM,WAAW,aAAa;IAC5B,2FAA2F;IAC3F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