lintmax 0.1.104 → 0.1.105

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,13 +1,14 @@
1
1
  #!/usr/bin/env bun
2
- import { B as OXLINT_CLI_ALLOW, D as isRecord, H as PARSE_DIALECTS, R as DEFAULT_SHARED_IGNORE_PATTERNS, S as joinPath, _ as runCapture, a as cacheDir, b as fromFileUrl, c as ensureDirectory, d as pathExists, f as readJson, g as run, h as resolveBin, i as PRETTIER_MD_ARGS, l as envValue, m as readVersion, n as listProjectFiles, o as cwd, p as readRequiredJson, r as CliExitError, s as decodeText, t as escapeGlobPath, u as lintmaxRoot, v as usage, y as dirnamePath, z as ESLINT_TEST_FILE_PATTERNS } from "./project-files-DudveeQZ.mjs";
3
- import { r as sync } from "./src-8LKWIKXe.mjs";
2
+ import { B as OXLINT_CLI_ALLOW, D as isRecord, H as PARSE_DIALECTS, R as DEFAULT_SHARED_IGNORE_PATTERNS, S as joinPath, _ as runCapture, a as cacheDir, b as fromFileUrl, c as ensureDirectory, d as pathExists, f as readJson, g as run, h as resolveBin, i as PRETTIER_MD_ARGS, l as envValue, m as readVersion, n as listProjectFiles, o as cwd, p as readRequiredJson, r as CliExitError, s as decodeText, t as escapeGlobPath, u as lintmaxRoot, v as usage, y as dirnamePath, z as ESLINT_TEST_FILE_PATTERNS } from "./project-files-C4cvEhY7.mjs";
3
+ import { r as sync } from "./src-DDkinCyR.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";
7
+ import { homedir, platform, tmpdir } from "node:os";
8
+ import { Buffer } from "node:buffer";
7
9
  import { parseSync } from "oxc-parser";
8
10
  import { ESLint } from "eslint";
9
11
  import { createHash } from "node:crypto";
10
- import { homedir, platform, tmpdir } from "node:os";
11
12
  //#region src/rule-equivalence.ts
12
13
  const equivalenceGroups = [
13
14
  [
@@ -1468,6 +1469,7 @@ const requireLintAnswer = ({ exitCode, label, stderr, stdout }) => {
1468
1469
  refuse("produced no parseable JSON");
1469
1470
  }
1470
1471
  if (!Array.isArray(parsed.diagnostics)) refuse("returned JSON carrying no diagnostics array");
1472
+ if (exitCode !== 0 && parsed.diagnostics.length === 0) refuse("failed with zero diagnostics");
1471
1473
  return json;
1472
1474
  };
1473
1475
  const firedOxlintByFile = async ({ configPath, files, oxlintBin }) => {
@@ -2039,13 +2041,28 @@ const captureAndParse = async ({ env, failures, label, opts, parser }) => {
2039
2041
  label
2040
2042
  });
2041
2043
  if (result.exitCode === 0) return [];
2042
- const diagnostics = parser(result);
2044
+ const byteCount = Buffer.byteLength(result.stdout);
2045
+ const stderrDetail = result.stderr ? `\n${result.stderr.trim()}` : "";
2046
+ let diagnostics;
2047
+ try {
2048
+ if (label === "eslint" || label === "biome" || label === "oxlint") readRequiredJson(result.stdout);
2049
+ diagnostics = parser(result);
2050
+ } catch (parseError) {
2051
+ const detail = parseError instanceof Error ? parseError.message : String(parseError);
2052
+ failures.push({
2053
+ code: result.exitCode,
2054
+ label,
2055
+ message: `Output parse error (${byteCount} bytes): ${detail}${stderrDetail}`
2056
+ });
2057
+ return [];
2058
+ }
2043
2059
  if (diagnostics.length > 0) return diagnostics;
2044
2060
  const stderr = result.stderr.trim();
2045
2061
  const stdout = result.stdout.trim();
2046
2062
  const stdoutFirst = stdout.split("\n", 1)[0]?.trimStart() ?? "";
2047
2063
  const stdoutMessage = stdoutFirst.startsWith("[") || stdoutFirst.startsWith("{") ? void 0 : stdout || void 0;
2048
- const message = stderr.length > 0 ? stderr : stdoutMessage;
2064
+ const detail = stderr.length > 0 ? stderr : stdoutMessage;
2065
+ const message = `Output parsed to zero diagnostics (${byteCount} bytes)${detail ? `\n${detail}` : ""}`;
2049
2066
  failures.push({
2050
2067
  code: result.exitCode,
2051
2068
  label,
package/dist/eslint.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A as normalizePathListInput, D as isRecord, E as findUnknownRules, M as normalizeTailwindOption, P as warnToError, R as DEFAULT_SHARED_IGNORE_PATTERNS, S as joinPath, U as SHARED_OVERRIDE_SYMBOL_KEY, W as TAILWIND_ENTRY_CANDIDATES, j as normalizeRulesOffInput, k as normalizeObjectListInput, n as listProjectFiles, x as isAbsolutePath, z as ESLINT_TEST_FILE_PATTERNS } from "./project-files-DudveeQZ.mjs";
1
+ import { A as normalizePathListInput, D as isRecord, E as findUnknownRules, M as normalizeTailwindOption, P as warnToError, R as DEFAULT_SHARED_IGNORE_PATTERNS, S as joinPath, U as SHARED_OVERRIDE_SYMBOL_KEY, W as TAILWIND_ENTRY_CANDIDATES, j as normalizeRulesOffInput, k as normalizeObjectListInput, n as listProjectFiles, x as isAbsolutePath, z as ESLINT_TEST_FILE_PATTERNS } from "./project-files-C4cvEhY7.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 +1 @@
1
- export { t as defineConfig, n as eslintImport, r as sync } from "./src-8LKWIKXe.mjs";
1
+ export { t as defineConfig, n as eslintImport, r as sync } from "./src-DDkinCyR.mjs";
@@ -1,6 +1,7 @@
1
1
  import { $, Glob, env, env as bunEnv, file, spawn } from "bun";
2
- import { lstat, realpath } from "node:fs/promises";
2
+ import { lstat, mkdtemp, realpath, rm, writeFile } from "node:fs/promises";
3
3
  import { dirname, join, resolve } from "node:path";
4
+ import { tmpdir } from "node:os";
4
5
  //#region src/constants.ts
5
6
  const BIOME_RULES_OFF = [
6
7
  "noBarrelFile",
@@ -440,13 +441,43 @@ const run = async ({ args, command, env, label, silent = false }) => {
440
441
  }
441
442
  throw new CliExitError({ code: result.exitCode });
442
443
  };
443
- const runCapture = async ({ args, command, env }) => {
444
- const result = await $`${command} ${args}`.cwd(cwd).env(env).quiet().nothrow();
445
- return {
446
- exitCode: result.exitCode,
447
- stderr: result.stderr.toString(),
448
- stdout: result.stdout.toString()
449
- };
444
+ const runCapture = async ({ args, command, env, label }) => {
445
+ const directory = await mkdtemp(joinPath(tmpdir(), "lintmax-output-"));
446
+ try {
447
+ const stdoutPath = joinPath(directory, "stdout");
448
+ const stderrPath = joinPath(directory, "stderr");
449
+ const outputPath = joinPath(directory, "diagnostics");
450
+ const outputArgs = label === "eslint" ? ["--output-file", outputPath] : [];
451
+ const nativeOutput = outputArgs.length > 0;
452
+ const captureArgs = [...args, ...outputArgs];
453
+ if (nativeOutput) await writeFile(outputPath, "");
454
+ const windows = process.platform === "win32";
455
+ const commandArgs = windows ? [command, ...captureArgs] : [
456
+ "/bin/sh",
457
+ "-c",
458
+ "stdout=$1; stderr=$2; shift 2; exec \"$@\" > \"$stdout\" 2> \"$stderr\"",
459
+ "lintmax-capture",
460
+ stdoutPath,
461
+ stderrPath,
462
+ command,
463
+ ...captureArgs
464
+ ];
465
+ const exitCode = await spawn(commandArgs, {
466
+ cwd,
467
+ env,
468
+ stderr: windows ? file(stderrPath) : "ignore",
469
+ stdout: windows ? file(stdoutPath) : "ignore",
470
+ timeout: 6e5
471
+ }).exited;
472
+ const [stderr, stdout] = await Promise.all([file(stderrPath).text(), file(nativeOutput ? outputPath : stdoutPath).text()]);
473
+ return {
474
+ exitCode,
475
+ stderr,
476
+ stdout
477
+ };
478
+ } finally {
479
+ await rm(directory, { recursive: true });
480
+ }
450
481
  };
451
482
  const envValue = (name) => bunEnv[name] ?? "";
452
483
  const readVersion = async () => {
@@ -1,4 +1,4 @@
1
- import { A as normalizePathListInput, C as assertJsonSerializable, E as findUnknownRules, F as BIOME_IGNORE_PATTERNS, I as BIOME_PATTERN_RULE_OVERRIDES, L as BIOME_RULES_OFF, M as normalizeTailwindOption, N as stripPluginNamespace, O as normalizeIgnorePattern, R as DEFAULT_SHARED_IGNORE_PATTERNS, S as joinPath, T as assertOptionalString, U as SHARED_OVERRIDE_SYMBOL_KEY, V as OXLINT_PATTERN_RULE_OVERRIDES, a as cacheDir, b as fromFileUrl, c as ensureDirectory, j as normalizeRulesOffInput, k as normalizeObjectListInput, n as listProjectFiles, p as readRequiredJson, w as assertObject, y as dirnamePath } from "./project-files-DudveeQZ.mjs";
1
+ import { A as normalizePathListInput, C as assertJsonSerializable, E as findUnknownRules, F as BIOME_IGNORE_PATTERNS, I as BIOME_PATTERN_RULE_OVERRIDES, L as BIOME_RULES_OFF, M as normalizeTailwindOption, N as stripPluginNamespace, O as normalizeIgnorePattern, R as DEFAULT_SHARED_IGNORE_PATTERNS, S as joinPath, T as assertOptionalString, U as SHARED_OVERRIDE_SYMBOL_KEY, V as OXLINT_PATTERN_RULE_OVERRIDES, a as cacheDir, b as fromFileUrl, c as ensureDirectory, j as normalizeRulesOffInput, k as normalizeObjectListInput, n as listProjectFiles, p as readRequiredJson, w as assertObject, y as dirnamePath } from "./project-files-C4cvEhY7.mjs";
2
2
  import { file, write } from "bun";
3
3
  import { lstat } from "node:fs/promises";
4
4
  import { join, relative } from "node:path";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lintmax",
3
- "version": "0.1.104",
3
+ "version": "0.1.105",
4
4
  "description": "The #1 anti AI slop typescript tooling. Designed for coding agents, not humans.",
5
5
  "keywords": [
6
6
  "agent",
@@ -55,7 +55,7 @@
55
55
  "prepublishOnly": "bun run build",
56
56
  "postpublish": "bun ../../tools/prune-versions.ts",
57
57
  "smoke": "bun script/smoke.ts",
58
- "test": "bun script/test-magic.ts && bun script/test-coverage.ts"
58
+ "test": "bun test src && bun script/test-magic.ts && bun script/test-coverage.ts"
59
59
  },
60
60
  "dependencies": {
61
61
  "@biomejs/biome": "latest",