Files
initiative/scripts/check-lint-ignores.mjs
Lukas 9b0cb38897 Fix oxlint --deny-warnings and eliminate all biome-ignores
--deny warnings was a no-op (not a valid category); the correct flag
is --deny-warnings. Fixed all 8 pre-existing warnings and removed
every biome-ignore from source and test files. Simplified the check
script to zero-tolerance: any biome-ignore now fails the build.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 16:17:30 +02:00

42 lines
989 B
JavaScript

/**
* Zero-tolerance check for biome-ignore comments.
*
* Any `biome-ignore` in tracked .ts/.tsx files fails the build.
* Fix the underlying issue instead of suppressing the rule.
*/
import { execSync } from "node:child_process";
import { readFileSync } from "node:fs";
const IGNORE_PATTERN = /biome-ignore\s+([\w/]+)/;
function findFiles() {
return execSync("git ls-files -- '*.ts' '*.tsx'", { encoding: "utf-8" })
.trim()
.split("\n")
.filter(Boolean);
}
let count = 0;
for (const file of findFiles()) {
const lines = readFileSync(file, "utf-8").split("\n");
for (let i = 0; i < lines.length; i++) {
const match = lines[i].match(IGNORE_PATTERN);
if (!match) continue;
count++;
console.error(`FORBIDDEN: ${file}:${i + 1} — biome-ignore ${match[1]}`);
}
}
if (count > 0) {
console.error(
`\n${count} biome-ignore comment(s) found. Fix the issue or restructure the code.`,
);
process.exit(1);
} else {
console.log("biome-ignore: 0 — all clear.");
}