lintmax 0.1.95 → 0.1.97

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 (2) hide show
  1. package/dist/cli.mjs +23 -11
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -625,13 +625,13 @@ const normalizeRule = (rule) => {
625
625
  };
626
626
  const loadOxlintOffRules = async () => {
627
627
  const configPath = joinPath(process.cwd(), cacheDir, ".oxlintrc.json");
628
+ if (!await file(configPath).exists()) throw new Error(`clean-ignores: the generated config is absent at ${configPath}, so no rule reads as off and every directive for an off rule would be kept. The stage that writes it did not run.`);
628
629
  let config;
629
630
  try {
630
631
  config = readRequiredJson(await file(configPath).text());
631
- } catch {
632
- config = null;
632
+ } catch (error) {
633
+ throw new Error(`clean-ignores: the generated config at ${configPath} carries no parseable JSON. Refusing rather than reading it as "no rule is off", which would silently keep every directive.`, { cause: error });
633
634
  }
634
- if (!config) return /* @__PURE__ */ new Set();
635
635
  const off = /* @__PURE__ */ new Set();
636
636
  for (const [rule, val] of Object.entries(config.rules ?? {})) if ((Array.isArray(val) ? String(val[0]) : val) === "off") {
637
637
  off.add(rule);
@@ -1443,10 +1443,24 @@ const rebuildBiomeLine = ({ line, rules }) => {
1443
1443
  * `{"diagnostics": []}` and exit 0 when they find nothing, so requiring a parsed diagnostics array refuses a
1444
1444
  * crash without ever refusing a clean tree.
1445
1445
  */
1446
+ const oxlintUnusedArgs = ({ configPath, files, oxlintBin }) => [
1447
+ oxlintBin,
1448
+ "-c",
1449
+ configPath,
1450
+ "-f",
1451
+ "json",
1452
+ ...OXLINT_CLI_ALLOW.flatMap((rule) => ["--allow", rule]),
1453
+ ...files
1454
+ ];
1446
1455
  const requireLintAnswer = ({ exitCode, label, stderr, stdout }) => {
1447
1456
  const json = extractJson(stdout);
1448
1457
  const refuse = (why) => {
1449
- throw new Error(`${label}: ${why} (exit ${exitCode}). Refusing rather than reading it as "nothing fired", which would report every directive unused. ${stderr.slice(0, 400)}`);
1458
+ const out = stdout.trim();
1459
+ const shape = `[${String(out.length)} bytes]`;
1460
+ const head = out.slice(0, 400);
1461
+ const tail = out.length > 400 ? ` … TAIL ${out.slice(-200)}` : "";
1462
+ const said = [stderr.trim(), `${shape} ${head}${tail}`].filter((part) => part !== "").join(" | ");
1463
+ throw new Error(`${label}: ${why} (exit ${exitCode}). Refusing rather than reading it as "nothing fired", which would report every directive unused. ${said}`);
1450
1464
  };
1451
1465
  let parsed;
1452
1466
  try {
@@ -1458,15 +1472,13 @@ const requireLintAnswer = ({ exitCode, label, stderr, stdout }) => {
1458
1472
  return json;
1459
1473
  };
1460
1474
  const firedOxlintByFile = async ({ configPath, files, oxlintBin }) => {
1475
+ if (!await file(configPath).exists()) throw new Error(`oxlint-unused: the generated config is absent at ${configPath}, so no rule can fire and every directive would read as unused. The stage that writes it did not run.`);
1461
1476
  const result = await runCapture({
1462
- args: [
1463
- oxlintBin,
1464
- "-c",
1477
+ args: oxlintUnusedArgs({
1465
1478
  configPath,
1466
- "-f",
1467
- "json",
1468
- ...files
1469
- ],
1479
+ files,
1480
+ oxlintBin
1481
+ }),
1470
1482
  command: "bun",
1471
1483
  env: buildEnv(),
1472
1484
  label: "oxlint-unused"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lintmax",
3
- "version": "0.1.95",
3
+ "version": "0.1.97",
4
4
  "description": "The #1 anti AI slop typescript tooling. Designed for coding agents, not humans.",
5
5
  "keywords": [
6
6
  "agent",