lintmax 0.1.83 → 0.1.84
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-
|
|
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-
|
|
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
|
|
451
|
+
const bin = await resolveBin({
|
|
452
452
|
bin: "oxlint",
|
|
453
453
|
pkg: "oxlint"
|
|
454
|
-
})
|
|
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
|
|
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,36 @@ 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
|
+
];
|
|
1028
1043
|
const runShfmtStep = async ({ bin, command, env, files }) => {
|
|
1029
1044
|
if (command === "fix") await runCapture({
|
|
1030
|
-
args: [
|
|
1045
|
+
args: [
|
|
1046
|
+
...SHFMT_FLAGS,
|
|
1047
|
+
"-w",
|
|
1048
|
+
...files
|
|
1049
|
+
],
|
|
1031
1050
|
command: bin,
|
|
1032
1051
|
env,
|
|
1033
1052
|
label: "shfmt"
|
|
1034
1053
|
});
|
|
1035
1054
|
const fmtCheck = await runCapture({
|
|
1036
|
-
args: [
|
|
1055
|
+
args: [
|
|
1056
|
+
...SHFMT_FLAGS,
|
|
1057
|
+
"-d",
|
|
1058
|
+
...files
|
|
1059
|
+
],
|
|
1037
1060
|
command: bin,
|
|
1038
1061
|
env,
|
|
1039
1062
|
label: "shfmt"
|
|
@@ -1044,6 +1067,7 @@ const runShfmtStep = async ({ bin, command, env, files }) => {
|
|
|
1044
1067
|
const runShellcheckStep = async ({ bin, env, files }) => {
|
|
1045
1068
|
const result = await runCapture({
|
|
1046
1069
|
args: [
|
|
1070
|
+
...SHELLCHECK_FLAGS,
|
|
1047
1071
|
"-f",
|
|
1048
1072
|
"gcc",
|
|
1049
1073
|
...files
|
|
@@ -1276,7 +1300,8 @@ const rulesFromContent = (content) => {
|
|
|
1276
1300
|
return rules;
|
|
1277
1301
|
};
|
|
1278
1302
|
const findDangerousSuppressions = async (cwd) => {
|
|
1279
|
-
const
|
|
1303
|
+
const excludes = DEFAULT_SHARED_IGNORE_PATTERNS.flatMap((p) => ["-g", `!${p}`]);
|
|
1304
|
+
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
1305
|
const out = [];
|
|
1281
1306
|
for (const raw of result.stdout.toString().trim().split("\n").filter(Boolean)) {
|
|
1282
1307
|
const parsed = parseRipgrepLine(raw, cwd);
|
|
@@ -1788,8 +1813,9 @@ const createStepExecutor = ({ env, failures, root }) => {
|
|
|
1788
1813
|
const throwIfFailures = () => {
|
|
1789
1814
|
if (failures.length === 0) return;
|
|
1790
1815
|
const details = formatFailureDetails(failures);
|
|
1816
|
+
const code = failures[0]?.code ?? 1;
|
|
1791
1817
|
throw new CliExitError({
|
|
1792
|
-
code
|
|
1818
|
+
code,
|
|
1793
1819
|
message: `One or more steps failed:\n${details}`
|
|
1794
1820
|
});
|
|
1795
1821
|
};
|
|
@@ -2097,7 +2123,8 @@ const createPrettierMarkdownTargets = async ({ gitFiles, gitWorkTree, isIgnored,
|
|
|
2097
2123
|
};
|
|
2098
2124
|
const throwAgentResults = ({ diagnostics, failures }) => {
|
|
2099
2125
|
if (diagnostics.length === 0 && failures.length === 0) return;
|
|
2100
|
-
const
|
|
2126
|
+
const grouped = aggregate({ diagnostics });
|
|
2127
|
+
const output = formatGrouped({ files: grouped });
|
|
2101
2128
|
if (output.length > 0) process.stdout.write(`${output}\n`);
|
|
2102
2129
|
if (failures.length > 0) {
|
|
2103
2130
|
const details = formatFailureDetails(failures);
|
|
@@ -2178,7 +2205,8 @@ const runCheckHuman = async (ctx) => {
|
|
|
2178
2205
|
}))
|
|
2179
2206
|
];
|
|
2180
2207
|
if (humanCustomDiags.length > 0) {
|
|
2181
|
-
const
|
|
2208
|
+
const grouped = aggregate({ diagnostics: humanCustomDiags });
|
|
2209
|
+
const output = formatGrouped({ files: grouped });
|
|
2182
2210
|
if (output.length > 0) process.stdout.write(`${output}\n`);
|
|
2183
2211
|
ctx.failures.push({
|
|
2184
2212
|
code: 1,
|
|
@@ -2207,7 +2235,8 @@ const runCheckAgent = async (ctx) => {
|
|
|
2207
2235
|
gitFiles: ctx.allGitFiles
|
|
2208
2236
|
})));
|
|
2209
2237
|
if (allDiagnostics.length > 0 || ctx.failures.length > 0) {
|
|
2210
|
-
const
|
|
2238
|
+
const grouped = aggregate({ diagnostics: allDiagnostics });
|
|
2239
|
+
const output = formatGrouped({ files: grouped });
|
|
2211
2240
|
if (output.length > 0) process.stdout.write(`${output}\n`);
|
|
2212
2241
|
if (ctx.failures.length > 0) process.stderr.write(`${formatFailureDetails(ctx.failures)}\n`);
|
|
2213
2242
|
throw new CliExitError({ code: 1 });
|
|
@@ -2464,8 +2493,8 @@ const hashTree = async ({ files, root, version }) => {
|
|
|
2464
2493
|
//#endregion
|
|
2465
2494
|
//#region src/staleness.ts
|
|
2466
2495
|
const httpTimeoutMs = 15e3;
|
|
2467
|
-
const cacheTtlMs =
|
|
2468
|
-
const sixMonthsMs =
|
|
2496
|
+
const cacheTtlMs = 864e5;
|
|
2497
|
+
const sixMonthsMs = 158112e5;
|
|
2469
2498
|
const envSkip = "LINTMAX_SKIP_STALENESS";
|
|
2470
2499
|
const envForce = "LINTMAX_STALENESS_FORCE";
|
|
2471
2500
|
/** 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 +2536,7 @@ const toIssue = (name, publishedAt) => {
|
|
|
2507
2536
|
const age = Date.now() - publishedAt;
|
|
2508
2537
|
if (age < sixMonthsMs) return null;
|
|
2509
2538
|
return {
|
|
2510
|
-
ageDays: Math.floor(age /
|
|
2539
|
+
ageDays: Math.floor(age / 864e5),
|
|
2511
2540
|
name
|
|
2512
2541
|
};
|
|
2513
2542
|
};
|
|
@@ -2567,7 +2596,8 @@ const persistGreen = async (greenKey) => {
|
|
|
2567
2596
|
/** 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
2597
|
const emitStaleness = async () => {
|
|
2569
2598
|
try {
|
|
2570
|
-
const
|
|
2599
|
+
const issues = await scanStaleness();
|
|
2600
|
+
const formatted = formatStaleness(issues);
|
|
2571
2601
|
if (formatted.length > 0) {
|
|
2572
2602
|
process.stderr.write(`${formatted}\n`);
|
|
2573
2603
|
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-
|
|
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-
|
|
1
|
+
import { n as eslintImport, r as sync, t as defineConfig } from "./src-2mkCC-JS.mjs";
|
|
2
2
|
export { defineConfig, eslintImport, sync };
|
|
@@ -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-
|
|
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
|
-
|
|
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
|
|
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
|
|
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 }) => {
|