Files
DumiFlex-ComfyUI-Wildcard-P…/scripts/lint-baseline.mjs
T
Dumitru Picalau 8d0fa337b2 chore: fixes from the 2026-10-21 review (#93)
Shorter release notes, SeedList help, small-model docs; _chat_turn split and pyright in CI; ESLint a11y ratchet and Modal focus trap; tags/models/Image Filter tests; AI LAN warning, web allow expiry, one thinking setting per answer on local models, recommended hints and Reset to recommended (16k context minimum, 32k recommended); Assembler Clear template clears the negative; Vue 3.5.44, SECURITY and Dependabot.
2026-10-22 06:15:13 +02:00

34 lines
1.5 KiB
JavaScript

#!/usr/bin/env node
/**
* Writes eslint-baseline.json: for each rule in RATCHET, the files that still
* break it. eslint.config.js makes those rules errors in every other file,
* so new code can't add to the pile while the old warnings are burned down.
*
* pnpm lint:baseline # after fixing warnings, to drop fixed files
*
* Only run it to SHRINK the lists; a file that newly breaks a rule should
* be fixed, not added.
*/
import { execFileSync } from "node:child_process";
import { readFileSync, writeFileSync } from "node:fs";
import path from "node:path";
const root = path.resolve(path.dirname(new URL(import.meta.url).pathname), "..");
const out = path.join(root, "eslint-baseline.json");
const { RATCHET } = JSON.parse(readFileSync(out, "utf8"));
// Lint with the ratchet off, so files that are now errors still report.
const raw = execFileSync("npx", ["eslint", "src", "-f", "json"], {
cwd: root, encoding: "utf8", maxBuffer: 256 * 1024 * 1024,
env: { ...process.env, WP_LINT_BASELINE: "off" },
});
const files = Object.fromEntries(RATCHET.map((r) => [r, new Set()]));
for (const f of JSON.parse(raw)) {
for (const m of f.messages) {
if (files[m.ruleId]) files[m.ruleId].add(path.relative(root, f.filePath).split(path.sep).join("/"));
}
}
const baseline = { RATCHET, files: Object.fromEntries(RATCHET.map((r) => [r, [...files[r]].sort()])) };
writeFileSync(out, JSON.stringify(baseline, null, 2) + "\n");
for (const r of RATCHET) console.log(`${r}: ${baseline.files[r].length} files`);