lintmax 0.1.83 → 0.1.85

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/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bun
2
- import { S as OXLINT_CLI_ALLOW, b as DEFAULT_SHARED_IGNORE_PATTERNS, i as joinPath, l as isRecord, n as fromFileUrl, t as dirnamePath, w as PARSE_DIALECTS, x as ESLINT_TEST_FILE_PATTERNS } from "./path-BJn_2Ond.mjs";
3
- import { _ as resolveBin, a as PRETTIER_MD_ARGS, b as usage, c as cwd, d as envValue, f as lintmaxRoot, g as readVersion, h as readRequiredJson, i as CliExitError, l as decodeText, m as readJson, o as bunEnv, p as pathExists, r as sync, s as cacheDir, u as ensureDirectory, v as run, y as runCapture } from "./src-Dd1x9nto.mjs";
2
+ import { S as OXLINT_CLI_ALLOW, b as DEFAULT_SHARED_IGNORE_PATTERNS, i as joinPath, l as isRecord, n as fromFileUrl, t as dirnamePath, w as PARSE_DIALECTS, x as ESLINT_TEST_FILE_PATTERNS } from "./path-C2uUsDNG.mjs";
3
+ import { _ as resolveBin, a as PRETTIER_MD_ARGS, b as usage, c as cwd, d as envValue, f as lintmaxRoot, g as readVersion, h as readRequiredJson, i as CliExitError, l as decodeText, m as readJson, o as bunEnv, p as pathExists, r as sync, s as cacheDir, u as ensureDirectory, v as run, y as runCapture } from "./src-2mkCC-JS.mjs";
4
4
  import { $, Glob, env, file, write } from "bun";
5
5
  import { lstat, unlink } from "node:fs/promises";
6
6
  import { join } from "node:path";
@@ -448,10 +448,11 @@ const extractBiomeRules = async () => {
448
448
  /** Reads oxlint's own resolved config. `--rules` prints nothing on current oxlint while still exiting 0 and still being listed in its help, so parsing that table yielded an empty oxlint section — and an empty section renders exactly like a linter that contributes nothing. It contributes 726 of the roughly 1738 rules this gate runs, so the command answering "what is enforced?" was wrong by more than a third while looking complete. */
449
449
  const extractOxlintRules = async () => {
450
450
  const configPath = joinPath(cwd, "node_modules/.cache/lintmax/.oxlintrc.json");
451
- const result = await $`bun ${await resolveBin({
451
+ const bin = await resolveBin({
452
452
  bin: "oxlint",
453
453
  pkg: "oxlint"
454
- })} -c ${configPath} --print-config`.cwd(cwd).quiet().nothrow();
454
+ });
455
+ const result = await $`bun ${bin} -c ${configPath} --print-config`.cwd(cwd).quiet().nothrow();
455
456
  if (result.exitCode !== 0) throw new Error(`oxlint --print-config failed, so its rule set is unknown: ${result.stderr.toString().trim()}`);
456
457
  const parsed = JSON.parse(result.stdout.toString());
457
458
  if (!isRecord(parsed)) throw new Error("oxlint --print-config returned no document");
@@ -619,7 +620,8 @@ const normalizeRule = (rule) => {
619
620
  return variants;
620
621
  };
621
622
  const loadOxlintOffRules = async () => {
622
- const config = await readRequiredJson({ path: joinPath(process.cwd(), cacheDir, ".oxlintrc.json") }).catch(() => null);
623
+ const configPath = joinPath(process.cwd(), cacheDir, ".oxlintrc.json");
624
+ const config = await readRequiredJson({ path: configPath }).catch(() => null);
623
625
  if (!config) return /* @__PURE__ */ new Set();
624
626
  const off = /* @__PURE__ */ new Set();
625
627
  for (const [rule, val] of Object.entries(config.rules ?? {})) if ((Array.isArray(val) ? String(val[0]) : val) === "off") {
@@ -1025,15 +1027,37 @@ const parseShellcheckLine = (line) => {
1025
1027
  };
1026
1028
  return null;
1027
1029
  };
1030
+ const SHFMT_FLAGS = [
1031
+ "-s",
1032
+ "-ci",
1033
+ "-bn",
1034
+ "-sr",
1035
+ "-i",
1036
+ "2"
1037
+ ];
1038
+ const SHELLCHECK_FLAGS = [
1039
+ "--enable=all",
1040
+ "--severity=style",
1041
+ "--external-sources",
1042
+ "--exclude=SC2312"
1043
+ ];
1028
1044
  const runShfmtStep = async ({ bin, command, env, files }) => {
1029
1045
  if (command === "fix") await runCapture({
1030
- args: ["-w", ...files],
1046
+ args: [
1047
+ ...SHFMT_FLAGS,
1048
+ "-w",
1049
+ ...files
1050
+ ],
1031
1051
  command: bin,
1032
1052
  env,
1033
1053
  label: "shfmt"
1034
1054
  });
1035
1055
  const fmtCheck = await runCapture({
1036
- args: ["-d", ...files],
1056
+ args: [
1057
+ ...SHFMT_FLAGS,
1058
+ "-d",
1059
+ ...files
1060
+ ],
1037
1061
  command: bin,
1038
1062
  env,
1039
1063
  label: "shfmt"
@@ -1044,6 +1068,7 @@ const runShfmtStep = async ({ bin, command, env, files }) => {
1044
1068
  const runShellcheckStep = async ({ bin, env, files }) => {
1045
1069
  const result = await runCapture({
1046
1070
  args: [
1071
+ ...SHELLCHECK_FLAGS,
1047
1072
  "-f",
1048
1073
  "gcc",
1049
1074
  ...files
@@ -1276,7 +1301,8 @@ const rulesFromContent = (content) => {
1276
1301
  return rules;
1277
1302
  };
1278
1303
  const findDangerousSuppressions = async (cwd) => {
1279
- const result = await $`rg -n "^\s*//\s*eslint-disable|^\s*/\*\s*eslint-disable|^\s*//\s*oxlint-disable|^\s*/\*\s*oxlint-disable|^\s*/\*\*\s*biome-ignore|^\s*//\s*@ts-ignore|^\s*//\s*@ts-expect-error|^\s*//\s*@ts-nocheck|^\s*/\*\s*@ts-nocheck" ${cwd} -g '*.ts' -g '*.tsx' -g '!node_modules' -g '!*.d.ts' ${DEFAULT_SHARED_IGNORE_PATTERNS.flatMap((p) => ["-g", `!${p}`])}`.quiet().nothrow();
1304
+ const excludes = DEFAULT_SHARED_IGNORE_PATTERNS.flatMap((p) => ["-g", `!${p}`]);
1305
+ const result = await $`rg -n "^\s*//\s*eslint-disable|^\s*/\*\s*eslint-disable|^\s*//\s*oxlint-disable|^\s*/\*\s*oxlint-disable|^\s*/\*\*\s*biome-ignore|^\s*//\s*@ts-ignore|^\s*//\s*@ts-expect-error|^\s*//\s*@ts-nocheck|^\s*/\*\s*@ts-nocheck" ${cwd} -g '*.ts' -g '*.tsx' -g '!node_modules' -g '!*.d.ts' ${excludes}`.quiet().nothrow();
1280
1306
  const out = [];
1281
1307
  for (const raw of result.stdout.toString().trim().split("\n").filter(Boolean)) {
1282
1308
  const parsed = parseRipgrepLine(raw, cwd);
@@ -1788,8 +1814,9 @@ const createStepExecutor = ({ env, failures, root }) => {
1788
1814
  const throwIfFailures = () => {
1789
1815
  if (failures.length === 0) return;
1790
1816
  const details = formatFailureDetails(failures);
1817
+ const code = failures[0]?.code ?? 1;
1791
1818
  throw new CliExitError({
1792
- code: failures[0]?.code ?? 1,
1819
+ code,
1793
1820
  message: `One or more steps failed:\n${details}`
1794
1821
  });
1795
1822
  };
@@ -2097,7 +2124,8 @@ const createPrettierMarkdownTargets = async ({ gitFiles, gitWorkTree, isIgnored,
2097
2124
  };
2098
2125
  const throwAgentResults = ({ diagnostics, failures }) => {
2099
2126
  if (diagnostics.length === 0 && failures.length === 0) return;
2100
- const output = formatGrouped({ files: aggregate({ diagnostics }) });
2127
+ const grouped = aggregate({ diagnostics });
2128
+ const output = formatGrouped({ files: grouped });
2101
2129
  if (output.length > 0) process.stdout.write(`${output}\n`);
2102
2130
  if (failures.length > 0) {
2103
2131
  const details = formatFailureDetails(failures);
@@ -2178,7 +2206,8 @@ const runCheckHuman = async (ctx) => {
2178
2206
  }))
2179
2207
  ];
2180
2208
  if (humanCustomDiags.length > 0) {
2181
- const output = formatGrouped({ files: aggregate({ diagnostics: humanCustomDiags }) });
2209
+ const grouped = aggregate({ diagnostics: humanCustomDiags });
2210
+ const output = formatGrouped({ files: grouped });
2182
2211
  if (output.length > 0) process.stdout.write(`${output}\n`);
2183
2212
  ctx.failures.push({
2184
2213
  code: 1,
@@ -2207,7 +2236,8 @@ const runCheckAgent = async (ctx) => {
2207
2236
  gitFiles: ctx.allGitFiles
2208
2237
  })));
2209
2238
  if (allDiagnostics.length > 0 || ctx.failures.length > 0) {
2210
- const output = formatGrouped({ files: aggregate({ diagnostics: allDiagnostics }) });
2239
+ const grouped = aggregate({ diagnostics: allDiagnostics });
2240
+ const output = formatGrouped({ files: grouped });
2211
2241
  if (output.length > 0) process.stdout.write(`${output}\n`);
2212
2242
  if (ctx.failures.length > 0) process.stderr.write(`${formatFailureDetails(ctx.failures)}\n`);
2213
2243
  throw new CliExitError({ code: 1 });
@@ -2464,8 +2494,8 @@ const hashTree = async ({ files, root, version }) => {
2464
2494
  //#endregion
2465
2495
  //#region src/staleness.ts
2466
2496
  const httpTimeoutMs = 15e3;
2467
- const cacheTtlMs = 1440 * 60 * 1e3;
2468
- const sixMonthsMs = 4392 * 60 * 60 * 1e3;
2497
+ const cacheTtlMs = 864e5;
2498
+ const sixMonthsMs = 158112e5;
2469
2499
  const envSkip = "LINTMAX_SKIP_STALENESS";
2470
2500
  const envForce = "LINTMAX_STALENESS_FORCE";
2471
2501
  /** Every linter this ships, read from the manifest that declares them. A hand-kept list beside the real one watches whatever it happened to name on the day it was written: it held eight of twenty-four, and the dep pinning the whole fleet to an old eslint major sat outside it, stale for well over a year, unseen. */
@@ -2507,7 +2537,7 @@ const toIssue = (name, publishedAt) => {
2507
2537
  const age = Date.now() - publishedAt;
2508
2538
  if (age < sixMonthsMs) return null;
2509
2539
  return {
2510
- ageDays: Math.floor(age / (1440 * 60 * 1e3)),
2540
+ ageDays: Math.floor(age / 864e5),
2511
2541
  name
2512
2542
  };
2513
2543
  };
@@ -2567,7 +2597,8 @@ const persistGreen = async (greenKey) => {
2567
2597
  /** A stale dep FAILS the gate: the baseline is clean, so every finding here is a new one, and a warning nobody has to act on is how the check sat broken for its whole life while printing nothing. A dep leaves the gate through `staleExceptions` with its reason and trigger, never by being tolerated in the output. A scan that cannot reach the registry is reported and does NOT fail — an offline developer is never blocked by it, but the silence that once read as clean is gone. */
2568
2598
  const emitStaleness = async () => {
2569
2599
  try {
2570
- const formatted = formatStaleness(await scanStaleness());
2600
+ const issues = await scanStaleness();
2601
+ const formatted = formatStaleness(issues);
2571
2602
  if (formatted.length > 0) {
2572
2603
  process.stderr.write(`${formatted}\n`);
2573
2604
  process.exitCode = 1;
package/dist/eslint.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { E as TAILWIND_ENTRY_CANDIDATES, T as SHARED_OVERRIDE_SYMBOL_KEY, b as DEFAULT_SHARED_IGNORE_PATTERNS, c as findUnknownRules, d as normalizeObjectListInput, f as normalizePathListInput, g as warnToError, i as joinPath, l as isRecord, m as normalizeTailwindOption, p as normalizeRulesOffInput, r as isAbsolutePath, x as ESLINT_TEST_FILE_PATTERNS } from "./path-BJn_2Ond.mjs";
1
+ import { E as TAILWIND_ENTRY_CANDIDATES, T as SHARED_OVERRIDE_SYMBOL_KEY, b as DEFAULT_SHARED_IGNORE_PATTERNS, c as findUnknownRules, d as normalizeObjectListInput, f as normalizePathListInput, g as warnToError, i as joinPath, l as isRecord, m as normalizeTailwindOption, p as normalizeRulesOffInput, r as isAbsolutePath, x as ESLINT_TEST_FILE_PATTERNS } from "./path-C2uUsDNG.mjs";
2
2
  import { file } from "bun";
3
3
  import eslintReact from "@eslint-react/eslint-plugin";
4
4
  import { includeIgnoreFile } from "@eslint/compat";
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { n as eslintImport, r as sync, t as defineConfig } from "./src-Dd1x9nto.mjs";
1
+ import { n as eslintImport, r as sync, t as defineConfig } from "./src-2mkCC-JS.mjs";
2
2
  export { defineConfig, eslintImport, sync };
@@ -25,6 +25,7 @@ const BIOME_RULES_OFF = [
25
25
  "noReactSpecificProps",
26
26
  "noSecrets",
27
27
  "noSolidDestructuredProps",
28
+ "noTailwindArbitraryValue",
28
29
  "noTernary",
29
30
  "noUndeclaredDependencies",
30
31
  "noUnresolvedImports",
@@ -1,4 +1,4 @@
1
- import { C as OXLINT_PATTERN_RULE_OVERRIDES, T as SHARED_OVERRIDE_SYMBOL_KEY, _ as BIOME_IGNORE_PATTERNS, a as assertJsonSerializable, b as DEFAULT_SHARED_IGNORE_PATTERNS, c as findUnknownRules, d as normalizeObjectListInput, f as normalizePathListInput, h as stripPluginNamespace, i as joinPath, l as isRecord, m as normalizeTailwindOption, n as fromFileUrl, o as assertObject, p as normalizeRulesOffInput, s as assertOptionalString, t as dirnamePath, u as normalizeIgnorePattern, v as BIOME_PATTERN_RULE_OVERRIDES, y as BIOME_RULES_OFF } from "./path-BJn_2Ond.mjs";
1
+ import { C as OXLINT_PATTERN_RULE_OVERRIDES, T as SHARED_OVERRIDE_SYMBOL_KEY, _ as BIOME_IGNORE_PATTERNS, a as assertJsonSerializable, b as DEFAULT_SHARED_IGNORE_PATTERNS, c as findUnknownRules, d as normalizeObjectListInput, f as normalizePathListInput, h as stripPluginNamespace, i as joinPath, l as isRecord, m as normalizeTailwindOption, n as fromFileUrl, o as assertObject, p as normalizeRulesOffInput, s as assertOptionalString, t as dirnamePath, u as normalizeIgnorePattern, v as BIOME_PATTERN_RULE_OVERRIDES, y as BIOME_RULES_OFF } from "./path-C2uUsDNG.mjs";
2
2
  import { $, env as bunEnv, file, write } from "bun";
3
3
  import { lstat } from "node:fs/promises";
4
4
  import { join, relative } from "node:path";
@@ -73,7 +73,9 @@ const resolveBin = async ({ bin, pkg }) => {
73
73
  message: `Cannot find ${pkg} — run: bun add -d ${pkg}`
74
74
  });
75
75
  const pkgJson = await readRequiredJson({ path: packageJsonPath });
76
- return joinPath(dirnamePath(packageJsonPath), typeof pkgJson.bin === "string" ? pkgJson.bin : pkgJson.bin?.[bin] ?? "");
76
+ const pkgDir = dirnamePath(packageJsonPath);
77
+ const binPath = typeof pkgJson.bin === "string" ? pkgJson.bin : pkgJson.bin?.[bin] ?? "";
78
+ return joinPath(pkgDir, binPath);
77
79
  };
78
80
  const run = async ({ args, command, env, label, silent = false }) => {
79
81
  const base = $`${command} ${args}`.cwd(cwd).env(env).nothrow();
@@ -135,7 +137,8 @@ const resolveSchemaPath = async ({ cwd }) => {
135
137
  throw new Error("Cannot find module @biomejs/biome/configuration_schema.json");
136
138
  };
137
139
  const resolveBiomeSchema = async ({ cwd }) => {
138
- const schema = await readRequiredJson({ path: await resolveSchemaPath({ cwd }) });
140
+ const schemaPath = await resolveSchemaPath({ cwd });
141
+ const schema = await readRequiredJson({ path: schemaPath });
139
142
  const rulesProps = schema.$defs.Rules?.properties ?? {};
140
143
  const categories = Object.keys(rulesProps).filter((k) => {
141
144
  return schema.$defs[k.charAt(0).toUpperCase() + k.slice(1)]?.properties !== void 0;
@@ -707,7 +710,8 @@ const createOxlintConfig = async ({ options, sharedIgnorePatterns }) => {
707
710
  };
708
711
  const resolveSyncImportSource = ({ cwd, dir, source }) => {
709
712
  if (!(source.startsWith(".") || source.startsWith(".."))) return source;
710
- const relativeSource = relative(dir, joinPath(cwd, source)).replaceAll("\\", "/");
713
+ const absoluteSource = joinPath(cwd, source);
714
+ const relativeSource = relative(dir, absoluteSource).replaceAll("\\", "/");
711
715
  return relativeSource.startsWith(".") ? relativeSource : `./${relativeSource}`;
712
716
  };
713
717
  const discoverSymlinkPatterns = async ({ root }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lintmax",
3
- "version": "0.1.83",
3
+ "version": "0.1.85",
4
4
  "description": "The #1 anti AI slop typescript tooling. Designed for coding agents, not humans.",
5
5
  "keywords": [
6
6
  "agent",