/** * 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."); }