@ariestools/toolchain 9.0.2 → 9.0.4
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/README.md +28 -0
- package/dist/actions/deplint/getExtendsFromTsconfigs.d.ts.map +1 -1
- package/dist/actions/index.d.ts +1 -0
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/lint.d.ts +10 -1
- package/dist/actions/lint.d.ts.map +1 -1
- package/dist/actions/lintMode.d.ts +18 -0
- package/dist/actions/lintMode.d.ts.map +1 -0
- package/dist/actions/lintNext.d.ts +7 -1
- package/dist/actions/lintNext.d.ts.map +1 -1
- package/dist/actions/lintNextRun.d.ts +3 -1
- package/dist/actions/lintNextRun.d.ts.map +1 -1
- package/dist/actions/lintNextWorker.d.ts +6 -0
- package/dist/actions/lintNextWorker.d.ts.map +1 -1
- package/dist/actions/lintSharedTypecheck.d.ts +10 -0
- package/dist/actions/lintSharedTypecheck.d.ts.map +1 -0
- package/dist/actions/lintSharedTypecheckRules.d.ts +24 -0
- package/dist/actions/lintSharedTypecheckRules.d.ts.map +1 -0
- package/dist/actions/relint.d.ts +10 -1
- package/dist/actions/relint.d.ts.map +1 -1
- package/dist/actions/tsc-validate/sharedValidate.d.ts +18 -0
- package/dist/actions/tsc-validate/sharedValidate.d.ts.map +1 -1
- package/dist/bin/package/build.mjs +87 -84
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +87 -84
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +87 -84
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/xy.mjs +544 -46
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/xy/lint/lint/runCommand.d.ts.map +1 -1
- package/dist/xy/lint/relintCommand.d.ts.map +1 -1
- package/package.json +6 -6
package/dist/bin/xy.mjs
CHANGED
|
@@ -24,7 +24,9 @@ import { performance as performance$1 } from "node:perf_hooks";
|
|
|
24
24
|
import util, { promisify, stripVTControlCharacters } from "node:util";
|
|
25
25
|
import ts from "typescript";
|
|
26
26
|
import { createHash, randomBytes } from "node:crypto";
|
|
27
|
-
import {
|
|
27
|
+
import { ESLint } from "eslint";
|
|
28
|
+
import { applyRecommendedConfigTypeChecked, collectTypeCheckedRuleNames, getRuleSeverity, parseRecommendedConfigSource } from "@ariestools/eslint-config-flat";
|
|
29
|
+
import { includeIgnoreFile } from "eslint/config";
|
|
28
30
|
import { pipeline } from "node:stream/promises";
|
|
29
31
|
import zlib from "node:zlib";
|
|
30
32
|
import { builtinRules } from "eslint/use-at-your-own-risk";
|
|
@@ -25691,21 +25693,16 @@ function isInPackageSubdirectory(pkg, fileName, directoryName) {
|
|
|
25691
25693
|
return relative !== "" && !relative.startsWith("../") && relative !== "..";
|
|
25692
25694
|
}
|
|
25693
25695
|
/**
|
|
25694
|
-
|
|
25695
|
-
|
|
25696
|
-
|
|
25697
|
-
* package's own), the same file set (tsconfig includes minus nested
|
|
25698
|
-
* workspace dirs), with `noEmit` and `rootDir` overridden the same way.
|
|
25699
|
-
* Only the compiler *host* is shared, for SourceFile reuse across packages.
|
|
25696
|
+
Create one package-specific TypeScript Program while reusing immutable parsed
|
|
25697
|
+
SourceFiles from earlier packages in the same process. Compiler options and the
|
|
25698
|
+
semantic Program remain package-specific.
|
|
25700
25699
|
*/
|
|
25701
|
-
function
|
|
25700
|
+
function createWorkspaceProgramInProcess(workspaceDir, cache) {
|
|
25702
25701
|
const pkg = PATH.resolve(workspaceDir);
|
|
25703
25702
|
const tsconfigPath = PATH.join(pkg, "tsconfig.json");
|
|
25704
25703
|
if (!fs.existsSync(tsconfigPath)) return {
|
|
25705
|
-
|
|
25706
|
-
|
|
25707
|
-
formatted: "",
|
|
25708
|
-
skipped: "no-tsconfig"
|
|
25704
|
+
kind: "skipped",
|
|
25705
|
+
reason: "no-tsconfig"
|
|
25709
25706
|
};
|
|
25710
25707
|
const formatHost = {
|
|
25711
25708
|
getCanonicalFileName: (fileName) => fileName,
|
|
@@ -25715,14 +25712,14 @@ function validateWorkspaceInProcess(workspaceDir, cache) {
|
|
|
25715
25712
|
const configFile = ts.readConfigFile(tsconfigPath, (fileName) => ts.sys.readFile(fileName));
|
|
25716
25713
|
if (configFile.error) return {
|
|
25717
25714
|
errorCount: 1,
|
|
25718
|
-
|
|
25719
|
-
|
|
25715
|
+
formatted: ts.formatDiagnosticsWithColorAndContext([configFile.error], formatHost),
|
|
25716
|
+
kind: "error"
|
|
25720
25717
|
};
|
|
25721
25718
|
const parsed = ts.parseJsonConfigFileContent(configFile.config, ts.sys, pkg, void 0, tsconfigPath);
|
|
25722
25719
|
if (parsed.errors.length > 0) return {
|
|
25723
25720
|
errorCount: parsed.errors.length,
|
|
25724
|
-
|
|
25725
|
-
|
|
25721
|
+
formatted: ts.formatDiagnosticsWithColorAndContext(parsed.errors, formatHost),
|
|
25722
|
+
kind: "error"
|
|
25726
25723
|
};
|
|
25727
25724
|
const rootNames = parsed.fileNames.filter((fileName) => !isInPackageSubdirectory(pkg, fileName, "packages"));
|
|
25728
25725
|
const options = {
|
|
@@ -25730,16 +25727,46 @@ function validateWorkspaceInProcess(workspaceDir, cache) {
|
|
|
25730
25727
|
noEmit: true,
|
|
25731
25728
|
rootDir: pkg
|
|
25732
25729
|
};
|
|
25733
|
-
|
|
25734
|
-
|
|
25735
|
-
|
|
25730
|
+
return {
|
|
25731
|
+
kind: "ready",
|
|
25732
|
+
program: ts.createProgram({
|
|
25733
|
+
host: createSharedHost(options, cache),
|
|
25734
|
+
options,
|
|
25735
|
+
rootNames
|
|
25736
|
+
}),
|
|
25736
25737
|
rootNames
|
|
25737
|
-
}
|
|
25738
|
-
|
|
25738
|
+
};
|
|
25739
|
+
}
|
|
25740
|
+
/**
|
|
25741
|
+
* Validates one package in-process, reproducing exactly the program that
|
|
25742
|
+
* `package-compile --validate-only` runs via `tsc -p`: the package's own
|
|
25743
|
+
* tsconfig (its `lib`, `jsx`, `types`, `paths` — every option is the
|
|
25744
|
+
* package's own), the same file set (tsconfig includes minus nested
|
|
25745
|
+
* workspace dirs), with `noEmit` and `rootDir` overridden the same way.
|
|
25746
|
+
* Only the compiler *host* is shared, for SourceFile reuse across packages.
|
|
25747
|
+
*/
|
|
25748
|
+
function validateWorkspaceInProcess(workspaceDir, cache) {
|
|
25749
|
+
const result = createWorkspaceProgramInProcess(workspaceDir, cache);
|
|
25750
|
+
if (result.kind === "skipped") return {
|
|
25751
|
+
errorCount: 0,
|
|
25752
|
+
fileCount: 0,
|
|
25753
|
+
formatted: "",
|
|
25754
|
+
skipped: "no-tsconfig"
|
|
25755
|
+
};
|
|
25756
|
+
if (result.kind === "error") return {
|
|
25757
|
+
errorCount: result.errorCount,
|
|
25758
|
+
fileCount: 0,
|
|
25759
|
+
formatted: result.formatted
|
|
25760
|
+
};
|
|
25761
|
+
const diagnostics = ts.getPreEmitDiagnostics(result.program);
|
|
25739
25762
|
return {
|
|
25740
25763
|
errorCount: diagnostics.filter((diagnostic) => diagnostic.category === ts.DiagnosticCategory.Error).length,
|
|
25741
|
-
fileCount: rootNames.length,
|
|
25742
|
-
formatted: diagnostics.length > 0 ? ts.formatDiagnosticsWithColorAndContext(diagnostics,
|
|
25764
|
+
fileCount: result.rootNames.length,
|
|
25765
|
+
formatted: diagnostics.length > 0 ? ts.formatDiagnosticsWithColorAndContext(diagnostics, {
|
|
25766
|
+
getCanonicalFileName: (fileName) => fileName,
|
|
25767
|
+
getCurrentDirectory: () => PATH.resolve(workspaceDir),
|
|
25768
|
+
getNewLine: () => ts.sys.newLine
|
|
25769
|
+
}) : ""
|
|
25743
25770
|
};
|
|
25744
25771
|
}
|
|
25745
25772
|
//#endregion
|
|
@@ -27201,6 +27228,14 @@ function parseTypesField(value) {
|
|
|
27201
27228
|
if (Array.isArray(value)) return value.filter((v) => typeof v === "string");
|
|
27202
27229
|
return [];
|
|
27203
27230
|
}
|
|
27231
|
+
function parseCompilerOptions(value, basePath, configFileName) {
|
|
27232
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return {};
|
|
27233
|
+
return ts.convertCompilerOptionsFromJson(value, basePath, configFileName).options;
|
|
27234
|
+
}
|
|
27235
|
+
function resolveTypeReferencePackage(ref, containingFile, compilerOptions) {
|
|
27236
|
+
const packageName = ts.resolveTypeReferenceDirective(ref, containingFile, compilerOptions, ts.sys).resolvedTypeReferenceDirective?.packageId?.name;
|
|
27237
|
+
return packageName === void 0 ? void 0 : getBasePackageName(packageName);
|
|
27238
|
+
}
|
|
27204
27239
|
function parsePathsField(value) {
|
|
27205
27240
|
if (typeof value !== "object" || value === null) return [];
|
|
27206
27241
|
return Object.keys(value);
|
|
@@ -27280,7 +27315,11 @@ function getTypesFromTsconfigs(location) {
|
|
|
27280
27315
|
for (const file of collectTsconfigFiles(location)) try {
|
|
27281
27316
|
const compilerOptions = parseTsconfig(file).compilerOptions;
|
|
27282
27317
|
const refs = parseTypesField(compilerOptions?.types);
|
|
27283
|
-
|
|
27318
|
+
const resolvedCompilerOptions = parseCompilerOptions(compilerOptions, PATH.dirname(file), file);
|
|
27319
|
+
for (const ref of refs) {
|
|
27320
|
+
const packageName = resolveTypeReferencePackage(ref, file, resolvedCompilerOptions);
|
|
27321
|
+
if (packageName !== void 0) packages.add(packageName);
|
|
27322
|
+
}
|
|
27284
27323
|
} catch {}
|
|
27285
27324
|
return [...packages];
|
|
27286
27325
|
}
|
|
@@ -31249,6 +31288,32 @@ const deplintPick = async ({ classifier, jobs, pkg, verbose } = {}) => {
|
|
|
31249
31288
|
return emptyPickResult(rows.length, decisions.length, changedFiles);
|
|
31250
31289
|
};
|
|
31251
31290
|
//#endregion
|
|
31291
|
+
//#region src/actions/lintMode.ts
|
|
31292
|
+
const lintModes = [
|
|
31293
|
+
"package-workers",
|
|
31294
|
+
"shared-typecheck",
|
|
31295
|
+
"workspace-eslint"
|
|
31296
|
+
];
|
|
31297
|
+
const defaultLintMode = "package-workers";
|
|
31298
|
+
/**
|
|
31299
|
+
Resolve the named lint implementation while preserving the two historical
|
|
31300
|
+
boolean selectors as hidden transition aliases.
|
|
31301
|
+
*/
|
|
31302
|
+
function resolveLintMode({ mode = defaultLintMode, next = false, prev = false }) {
|
|
31303
|
+
if (next && prev) throw new Error("--next and --prev cannot be combined; use --mode instead");
|
|
31304
|
+
const legacyMode = next ? "package-workers" : prev ? "workspace-eslint" : void 0;
|
|
31305
|
+
if (legacyMode !== void 0 && mode !== "package-workers" && mode !== legacyMode) throw new Error(`--mode ${mode} cannot be combined with ${next ? "--next" : "--prev"}`);
|
|
31306
|
+
if (next) return {
|
|
31307
|
+
legacyOption: "--next",
|
|
31308
|
+
mode: "package-workers"
|
|
31309
|
+
};
|
|
31310
|
+
if (prev) return {
|
|
31311
|
+
legacyOption: "--prev",
|
|
31312
|
+
mode: "workspace-eslint"
|
|
31313
|
+
};
|
|
31314
|
+
return { mode };
|
|
31315
|
+
}
|
|
31316
|
+
//#endregion
|
|
31252
31317
|
//#region src/actions/lintNextWorker.ts
|
|
31253
31318
|
const lintNextIgnorePatterns = ["packages/**"];
|
|
31254
31319
|
const lintNextResultMarker = "__XY_LINT_NEXT_RESULT__";
|
|
@@ -31349,8 +31414,24 @@ function gitignoreOverrideBlock(options) {
|
|
|
31349
31414
|
})
|
|
31350
31415
|
}
|
|
31351
31416
|
|
|
31417
|
+
function structuralOverrideBlock(options) {
|
|
31418
|
+
if (options.phase !== 'structural') return undefined
|
|
31419
|
+
const rules = Object.fromEntries((options.typeCheckedRuleNames ?? []).map(ruleName => [ruleName, 'off']))
|
|
31420
|
+
return {
|
|
31421
|
+
files: cycleRuleFilePatterns,
|
|
31422
|
+
languageOptions: {
|
|
31423
|
+
parserOptions: {
|
|
31424
|
+
programs: null,
|
|
31425
|
+
project: false,
|
|
31426
|
+
projectService: false,
|
|
31427
|
+
},
|
|
31428
|
+
},
|
|
31429
|
+
rules,
|
|
31430
|
+
}
|
|
31431
|
+
}
|
|
31432
|
+
|
|
31352
31433
|
function additionalOverrideBlocks(options) {
|
|
31353
|
-
return [gitignoreOverrideBlock(options), cycleOverrideBlock(options)].filter(Boolean)
|
|
31434
|
+
return [gitignoreOverrideBlock(options), structuralOverrideBlock(options), cycleOverrideBlock(options)].filter(Boolean)
|
|
31354
31435
|
}
|
|
31355
31436
|
|
|
31356
31437
|
async function createLintEngine(cwd, options) {
|
|
@@ -31358,10 +31439,12 @@ async function createLintEngine(cwd, options) {
|
|
|
31358
31439
|
const overrideSpec = options.configOverride ?? options.analyzeTier
|
|
31359
31440
|
if (overrideSpec) {
|
|
31360
31441
|
const gitignoreBlock = gitignoreOverrideBlock(options)
|
|
31442
|
+
const structuralBlock = structuralOverrideBlock(options)
|
|
31361
31443
|
const cycleBlock = cycleOverrideBlock(options)
|
|
31362
31444
|
const overrideConfig = [
|
|
31363
31445
|
...(gitignoreBlock === undefined ? [] : [gitignoreBlock]),
|
|
31364
31446
|
...await resolveAnalyzeOverrideConfig(cwd, overrideSpec),
|
|
31447
|
+
...(structuralBlock === undefined ? [] : [structuralBlock]),
|
|
31365
31448
|
...(cycleBlock === undefined ? [] : [cycleBlock]),
|
|
31366
31449
|
]
|
|
31367
31450
|
return new ESLint({
|
|
@@ -31821,7 +31904,7 @@ function emptyPackageResult(pkg) {
|
|
|
31821
31904
|
* Classify packages, skip empty/meta as configured, then lint the rest via
|
|
31822
31905
|
* the persistent ESLint worker pool.
|
|
31823
31906
|
*/
|
|
31824
|
-
async function runLintNextPackages({ analyze, analyzeTier, cache, concurrency, cycleDepth, fix, gitignore, meta, onPackageResult, profile, rootDir, skipEmpty, tierContext, typeChecked, verbose, workspaces }) {
|
|
31907
|
+
async function runLintNextPackages({ analyze, analyzeTier, cache, concurrency, cycleDepth, fix, gitignore, meta, onPackageResult, phase = "full", profile, rootDir, skipEmpty, tierContext, typeChecked, typeCheckedRuleNames, verbose, workspaces }) {
|
|
31825
31908
|
const forceFull = workspaces.length === 1;
|
|
31826
31909
|
const classified = workspaces.map((ws) => {
|
|
31827
31910
|
return {
|
|
@@ -31874,7 +31957,9 @@ async function runLintNextPackages({ analyze, analyzeTier, cache, concurrency, c
|
|
|
31874
31957
|
fix,
|
|
31875
31958
|
gitignore,
|
|
31876
31959
|
gitignorePath,
|
|
31960
|
+
phase,
|
|
31877
31961
|
profile,
|
|
31962
|
+
typeCheckedRuleNames,
|
|
31878
31963
|
verbose
|
|
31879
31964
|
}
|
|
31880
31965
|
});
|
|
@@ -31902,6 +31987,370 @@ async function runLintNextPackages({ analyze, analyzeTier, cache, concurrency, c
|
|
|
31902
31987
|
return [...skippedResults, ...lintResults];
|
|
31903
31988
|
}
|
|
31904
31989
|
//#endregion
|
|
31990
|
+
//#region src/actions/lintSharedTypecheckRules.ts
|
|
31991
|
+
init_index_min();
|
|
31992
|
+
const sharedTypecheckScriptPatterns = [
|
|
31993
|
+
"**/*.ts",
|
|
31994
|
+
"**/*.tsx",
|
|
31995
|
+
"**/*.mts",
|
|
31996
|
+
"**/*.cts",
|
|
31997
|
+
"**/*.js",
|
|
31998
|
+
"**/*.jsx",
|
|
31999
|
+
"**/*.cjs",
|
|
32000
|
+
"**/*.mjs",
|
|
32001
|
+
"**/*.d.ts",
|
|
32002
|
+
"**/*.d.tsx",
|
|
32003
|
+
"**/*.d.jsx",
|
|
32004
|
+
"**/*.d.mts",
|
|
32005
|
+
"**/*.d.cts"
|
|
32006
|
+
];
|
|
32007
|
+
const packageIgnorePatterns = [
|
|
32008
|
+
"packages/**",
|
|
32009
|
+
"**/build/**",
|
|
32010
|
+
"**/dist/**",
|
|
32011
|
+
"**/node_modules/**"
|
|
32012
|
+
];
|
|
32013
|
+
function configPackageName(configOverride) {
|
|
32014
|
+
return configOverride.configPackageName ?? (configOverride.isReact ? "@ariestools/eslint-config-react-flat" : "@ariestools/eslint-config-flat");
|
|
32015
|
+
}
|
|
32016
|
+
function mergeRules(configs) {
|
|
32017
|
+
const rules = {};
|
|
32018
|
+
for (const config of configs) Object.assign(rules, config.rules);
|
|
32019
|
+
return rules;
|
|
32020
|
+
}
|
|
32021
|
+
function isEnabledRule(entry) {
|
|
32022
|
+
const severity = getRuleSeverity(entry);
|
|
32023
|
+
return severity !== void 0 && severity !== "off";
|
|
32024
|
+
}
|
|
32025
|
+
async function resolveManagedTypeCheckedRuleNames(rootDir, configOverride) {
|
|
32026
|
+
const result = new Set(collectTypeCheckedRuleNames());
|
|
32027
|
+
if (configOverride === void 0) return result;
|
|
32028
|
+
const resolved = createRequire(PATH.join(rootDir, "package.json")).resolve(configPackageName(configOverride));
|
|
32029
|
+
const configPackage = await import(pathToFileURL(resolved).href);
|
|
32030
|
+
if (configPackage.recommendedConfig === void 0) return result;
|
|
32031
|
+
const common = { tier: configOverride.tier };
|
|
32032
|
+
const checked = mergeRules(configPackage.recommendedConfig({
|
|
32033
|
+
...common,
|
|
32034
|
+
isTypeChecked: true
|
|
32035
|
+
}));
|
|
32036
|
+
const unchecked = mergeRules(configPackage.recommendedConfig({
|
|
32037
|
+
...common,
|
|
32038
|
+
isTypeChecked: false
|
|
32039
|
+
}));
|
|
32040
|
+
for (const [ruleName, entry] of Object.entries(checked)) if (isEnabledRule(entry) && !isEnabledRule(unchecked[ruleName])) result.add(ruleName);
|
|
32041
|
+
return result;
|
|
32042
|
+
}
|
|
32043
|
+
async function resolveConfigOverride(cwd, configOverride) {
|
|
32044
|
+
const resolved = createRequire(PATH.join(cwd, "package.json")).resolve(configPackageName(configOverride));
|
|
32045
|
+
const configPackage = await import(pathToFileURL(resolved).href);
|
|
32046
|
+
if (configPackage.recommendedConfig !== void 0) return configPackage.recommendedConfig({
|
|
32047
|
+
isTypeChecked: configOverride.isTypeChecked,
|
|
32048
|
+
tier: configOverride.tier
|
|
32049
|
+
});
|
|
32050
|
+
const configs = configPackage[configOverride.exportName];
|
|
32051
|
+
if (!Array.isArray(configs)) throw new TypeError(`Missing ESLint tier export "${configOverride.exportName}"`);
|
|
32052
|
+
return configs;
|
|
32053
|
+
}
|
|
32054
|
+
async function baseSharedTypecheckConfigs(cwd, configOverride, gitignorePath) {
|
|
32055
|
+
const ignored = gitignorePath === void 0 ? void 0 : includeIgnoreFile(gitignorePath, {
|
|
32056
|
+
gitignoreResolution: true,
|
|
32057
|
+
name: "XY repository .gitignore"
|
|
32058
|
+
});
|
|
32059
|
+
if (configOverride === void 0) return { configs: ignored === void 0 ? [] : [ignored] };
|
|
32060
|
+
return {
|
|
32061
|
+
configs: [...ignored === void 0 ? [] : [ignored], ...await resolveConfigOverride(cwd, configOverride)],
|
|
32062
|
+
overrideConfigFile: true
|
|
32063
|
+
};
|
|
32064
|
+
}
|
|
32065
|
+
function sharedTypecheckEslintOptions({ configs, cwd, fix, overrideConfigFile }) {
|
|
32066
|
+
return {
|
|
32067
|
+
cache: false,
|
|
32068
|
+
cwd,
|
|
32069
|
+
fix,
|
|
32070
|
+
ignorePatterns: ["packages/**"],
|
|
32071
|
+
overrideConfig: configs,
|
|
32072
|
+
...overrideConfigFile !== void 0 && { overrideConfigFile },
|
|
32073
|
+
warnIgnored: false
|
|
32074
|
+
};
|
|
32075
|
+
}
|
|
32076
|
+
function ruleRequiresTypeChecking(config, ruleName) {
|
|
32077
|
+
const slash = ruleName.lastIndexOf("/");
|
|
32078
|
+
if (slash <= 0) return false;
|
|
32079
|
+
const pluginName = ruleName.slice(0, slash);
|
|
32080
|
+
const localRuleName = ruleName.slice(slash + 1);
|
|
32081
|
+
return ((config.plugins?.[pluginName])?.rules?.[localRuleName])?.meta?.docs?.requiresTypeChecking === true;
|
|
32082
|
+
}
|
|
32083
|
+
function collectActiveRules(config, plan) {
|
|
32084
|
+
const entries = Object.entries(config.rules ?? {});
|
|
32085
|
+
for (const [ruleName, entry] of entries) {
|
|
32086
|
+
if (!isEnabledRule(entry)) continue;
|
|
32087
|
+
plan.activeRuleNames.add(ruleName);
|
|
32088
|
+
if (ruleRequiresTypeChecking(config, ruleName)) plan.typeCheckedRuleNames.add(ruleName);
|
|
32089
|
+
}
|
|
32090
|
+
}
|
|
32091
|
+
async function inspectPackageRules({ configOverride, cwd, gitignorePath, knownTypeCheckedRuleNames }) {
|
|
32092
|
+
const base = await baseSharedTypecheckConfigs(cwd, configOverride, gitignorePath);
|
|
32093
|
+
const engine = new ESLint(sharedTypecheckEslintOptions({
|
|
32094
|
+
configs: base.configs,
|
|
32095
|
+
cwd,
|
|
32096
|
+
fix: false,
|
|
32097
|
+
overrideConfigFile: base.overrideConfigFile
|
|
32098
|
+
}));
|
|
32099
|
+
const candidates = ts$1(sharedTypecheckScriptPatterns, {
|
|
32100
|
+
absolute: true,
|
|
32101
|
+
cwd,
|
|
32102
|
+
ignore: packageIgnorePatterns,
|
|
32103
|
+
nodir: true
|
|
32104
|
+
});
|
|
32105
|
+
const plan = {
|
|
32106
|
+
activeRuleNames: /* @__PURE__ */ new Set(),
|
|
32107
|
+
typeCheckedRuleNames: new Set(knownTypeCheckedRuleNames)
|
|
32108
|
+
};
|
|
32109
|
+
for (const file of candidates) {
|
|
32110
|
+
const config = await engine.calculateConfigForFile(file);
|
|
32111
|
+
if (config !== void 0) collectActiveRules(config, plan);
|
|
32112
|
+
}
|
|
32113
|
+
return plan;
|
|
32114
|
+
}
|
|
32115
|
+
async function withSharedTypecheckGitignore(gitignore, action) {
|
|
32116
|
+
const previous = process.env.XY_LINT_GITIGNORE;
|
|
32117
|
+
process.env.XY_LINT_GITIGNORE = gitignore ? "true" : "false";
|
|
32118
|
+
try {
|
|
32119
|
+
return await action();
|
|
32120
|
+
} finally {
|
|
32121
|
+
if (previous === void 0) delete process.env.XY_LINT_GITIGNORE;
|
|
32122
|
+
else process.env.XY_LINT_GITIGNORE = previous;
|
|
32123
|
+
}
|
|
32124
|
+
}
|
|
32125
|
+
async function inspectSharedTypecheckRulePlans({ analyze, analyzeTier, gitignore, rootDir, tierContext, typeChecked, workspaces }) {
|
|
32126
|
+
const configOverride = resolvePackageConfigOverride(typeChecked, analyze ? void 0 : tierContext, analyzeTier);
|
|
32127
|
+
const known = await resolveManagedTypeCheckedRuleNames(rootDir, configOverride ?? (tierContext?.hasXylabsConfig === true ? buildForcedConfigOverride(tierContext, true) : void 0));
|
|
32128
|
+
const repositoryGitignore = PATH.resolve(rootDir, ".gitignore");
|
|
32129
|
+
const gitignorePath = gitignore && existsSync(repositoryGitignore) ? repositoryGitignore : void 0;
|
|
32130
|
+
const plans = /* @__PURE__ */ new Map();
|
|
32131
|
+
const allTypeCheckedRuleNames = new Set(known);
|
|
32132
|
+
await withSharedTypecheckGitignore(gitignore, async () => {
|
|
32133
|
+
for (const workspace of workspaces) {
|
|
32134
|
+
const plan = await inspectPackageRules({
|
|
32135
|
+
configOverride,
|
|
32136
|
+
cwd: PATH.resolve(rootDir, workspace.location),
|
|
32137
|
+
gitignorePath,
|
|
32138
|
+
knownTypeCheckedRuleNames: known
|
|
32139
|
+
});
|
|
32140
|
+
plans.set(workspace.name, plan);
|
|
32141
|
+
for (const ruleName of plan.typeCheckedRuleNames) allTypeCheckedRuleNames.add(ruleName);
|
|
32142
|
+
}
|
|
32143
|
+
});
|
|
32144
|
+
return {
|
|
32145
|
+
allTypeCheckedRuleNames: [...allTypeCheckedRuleNames],
|
|
32146
|
+
plans
|
|
32147
|
+
};
|
|
32148
|
+
}
|
|
32149
|
+
//#endregion
|
|
32150
|
+
//#region src/actions/lintSharedTypecheck.ts
|
|
32151
|
+
const scriptExtensionPattern = /\.(?:[cm]?[jt]s|[jt]sx)$/u;
|
|
32152
|
+
function lintableWorkspaces({ meta, rootDir, skipEmpty, workspaces }) {
|
|
32153
|
+
const forceFull = workspaces.length === 1;
|
|
32154
|
+
return workspaces.filter((workspace) => {
|
|
32155
|
+
return classifyLintPackage(rootDir, workspace, workspaces, {
|
|
32156
|
+
forceFull,
|
|
32157
|
+
meta,
|
|
32158
|
+
skipEmpty
|
|
32159
|
+
}).mode !== "skip";
|
|
32160
|
+
});
|
|
32161
|
+
}
|
|
32162
|
+
function emptySemanticResult(pkg) {
|
|
32163
|
+
return {
|
|
32164
|
+
errors: 0,
|
|
32165
|
+
files: 0,
|
|
32166
|
+
messages: [],
|
|
32167
|
+
output: "",
|
|
32168
|
+
pkg,
|
|
32169
|
+
timeMs: 0,
|
|
32170
|
+
warnings: 0
|
|
32171
|
+
};
|
|
32172
|
+
}
|
|
32173
|
+
function failedSemanticResult(pkg, output, timeMs) {
|
|
32174
|
+
return {
|
|
32175
|
+
errors: 1,
|
|
32176
|
+
files: 0,
|
|
32177
|
+
messages: [],
|
|
32178
|
+
output,
|
|
32179
|
+
pkg,
|
|
32180
|
+
timeMs,
|
|
32181
|
+
warnings: 0
|
|
32182
|
+
};
|
|
32183
|
+
}
|
|
32184
|
+
async function lintSemanticPackage({ analyze, configOverride, fix, gitignore, gitignorePath, profile, rulePlan, sharedCache, verbose, workspace }) {
|
|
32185
|
+
const started = performance$1.now();
|
|
32186
|
+
const programResult = createWorkspaceProgramInProcess(workspace.location, sharedCache);
|
|
32187
|
+
if (programResult.kind === "skipped") return failedSemanticResult(workspace.name, `Shared typecheck [${workspace.name}] requires ${PATH.join(workspace.location, "tsconfig.json")}\n`, Math.round(performance$1.now() - started));
|
|
32188
|
+
if (programResult.kind === "error") return failedSemanticResult(workspace.name, programResult.formatted, Math.round(performance$1.now() - started));
|
|
32189
|
+
const lintFiles = programResult.rootNames.filter((fileName) => scriptExtensionPattern.test(fileName));
|
|
32190
|
+
if (lintFiles.length === 0) return emptySemanticResult(workspace.name);
|
|
32191
|
+
const base = await baseSharedTypecheckConfigs(workspace.location, configOverride, gitignorePath);
|
|
32192
|
+
const disabledRules = Object.fromEntries([...rulePlan.activeRuleNames].filter((ruleName) => !rulePlan.typeCheckedRuleNames.has(ruleName)).map((ruleName) => [ruleName, "off"]));
|
|
32193
|
+
const semanticConfig = {
|
|
32194
|
+
files: sharedTypecheckScriptPatterns,
|
|
32195
|
+
languageOptions: { parserOptions: {
|
|
32196
|
+
programs: [programResult.program],
|
|
32197
|
+
project: false,
|
|
32198
|
+
projectService: false
|
|
32199
|
+
} },
|
|
32200
|
+
rules: disabledRules
|
|
32201
|
+
};
|
|
32202
|
+
const engine = new ESLint(sharedTypecheckEslintOptions({
|
|
32203
|
+
configs: [...base.configs, semanticConfig],
|
|
32204
|
+
cwd: workspace.location,
|
|
32205
|
+
fix: analyze ? false : fix,
|
|
32206
|
+
overrideConfigFile: base.overrideConfigFile
|
|
32207
|
+
}));
|
|
32208
|
+
const lintStarted = performance$1.now();
|
|
32209
|
+
const lintResults = await withSharedTypecheckGitignore(gitignore, async () => engine.lintFiles(lintFiles));
|
|
32210
|
+
const finished = performance$1.now();
|
|
32211
|
+
if (fix && !analyze) await ESLint.outputFixes(lintResults);
|
|
32212
|
+
let output = "";
|
|
32213
|
+
if (!analyze || verbose) output = await (await engine.loadFormatter("stylish")).format(lintResults);
|
|
32214
|
+
const result = {
|
|
32215
|
+
errors: lintResults.reduce((sum, entry) => sum + entry.errorCount, 0),
|
|
32216
|
+
files: lintResults.length,
|
|
32217
|
+
messages: analyze ? lintResults.flatMap((entry) => entry.messages.map((message) => ({
|
|
32218
|
+
ruleId: message.ruleId ?? null,
|
|
32219
|
+
severity: message.severity
|
|
32220
|
+
}))) : [],
|
|
32221
|
+
output,
|
|
32222
|
+
pkg: workspace.name,
|
|
32223
|
+
timeMs: Math.round(finished - started),
|
|
32224
|
+
warnings: lintResults.reduce((sum, entry) => sum + entry.warningCount, 0)
|
|
32225
|
+
};
|
|
32226
|
+
if (profile) result.profile = {
|
|
32227
|
+
configMs: Math.round(lintStarted - started),
|
|
32228
|
+
lintMs: Math.round(finished - lintStarted),
|
|
32229
|
+
spawnMs: 0,
|
|
32230
|
+
wallMs: result.timeMs,
|
|
32231
|
+
totalMs: Math.round(finished - started)
|
|
32232
|
+
};
|
|
32233
|
+
return result;
|
|
32234
|
+
}
|
|
32235
|
+
function mergeOutput(first, second) {
|
|
32236
|
+
if (first.length === 0) return second;
|
|
32237
|
+
if (second.length === 0) return first;
|
|
32238
|
+
return `${first.endsWith("\n") ? first : `${first}\n`}${second}`;
|
|
32239
|
+
}
|
|
32240
|
+
function mergePackageResults(structural, semantic) {
|
|
32241
|
+
if (semantic === void 0) return structural;
|
|
32242
|
+
const result = {
|
|
32243
|
+
errors: structural.errors + semantic.errors,
|
|
32244
|
+
files: structural.files,
|
|
32245
|
+
messages: [...structural.messages, ...semantic.messages],
|
|
32246
|
+
output: mergeOutput(structural.output, semantic.output),
|
|
32247
|
+
pkg: structural.pkg,
|
|
32248
|
+
timeMs: structural.timeMs + semantic.timeMs,
|
|
32249
|
+
warnings: structural.warnings + semantic.warnings
|
|
32250
|
+
};
|
|
32251
|
+
if (structural.profile !== void 0 || semantic.profile !== void 0) {
|
|
32252
|
+
const structuralProfile = structural.profile ?? {
|
|
32253
|
+
configMs: 0,
|
|
32254
|
+
lintMs: 0,
|
|
32255
|
+
spawnMs: 0,
|
|
32256
|
+
totalMs: 0,
|
|
32257
|
+
wallMs: structural.timeMs
|
|
32258
|
+
};
|
|
32259
|
+
const semanticProfile = semantic.profile ?? {
|
|
32260
|
+
configMs: 0,
|
|
32261
|
+
lintMs: 0,
|
|
32262
|
+
spawnMs: 0,
|
|
32263
|
+
totalMs: 0,
|
|
32264
|
+
wallMs: semantic.timeMs
|
|
32265
|
+
};
|
|
32266
|
+
result.profile = {
|
|
32267
|
+
configMs: structuralProfile.configMs + semanticProfile.configMs,
|
|
32268
|
+
lintMs: structuralProfile.lintMs + semanticProfile.lintMs,
|
|
32269
|
+
spawnMs: structuralProfile.spawnMs,
|
|
32270
|
+
totalMs: structuralProfile.totalMs + semanticProfile.totalMs,
|
|
32271
|
+
wallMs: structuralProfile.wallMs + semanticProfile.wallMs
|
|
32272
|
+
};
|
|
32273
|
+
}
|
|
32274
|
+
return result;
|
|
32275
|
+
}
|
|
32276
|
+
function isTypeCheckingEnabled({ analyzeTier, tierContext, typeChecked }) {
|
|
32277
|
+
if (analyzeTier !== void 0) return analyzeTier.isTypeChecked;
|
|
32278
|
+
if (typeChecked !== "auto") return typeChecked;
|
|
32279
|
+
return tierContext?.isTypeChecked ?? true;
|
|
32280
|
+
}
|
|
32281
|
+
function ignorePackageResult() {}
|
|
32282
|
+
/**
|
|
32283
|
+
Run syntax/structural rules in the existing package-worker pool while one
|
|
32284
|
+
process owns every package-specific TypeScript Program used by semantic rules.
|
|
32285
|
+
Only parsed SourceFiles are shared; compiler options and TypeCheckers remain
|
|
32286
|
+
isolated per package.
|
|
32287
|
+
*/
|
|
32288
|
+
async function runLintSharedTypecheckPackages(params) {
|
|
32289
|
+
if (!isTypeCheckingEnabled(params)) {
|
|
32290
|
+
if (params.profile) console.log(chalk.gray(" shared typecheck: disabled by effective ESLint configuration"));
|
|
32291
|
+
return await runLintNextPackages(params);
|
|
32292
|
+
}
|
|
32293
|
+
const targets = lintableWorkspaces(params);
|
|
32294
|
+
const { allTypeCheckedRuleNames, plans } = await inspectSharedTypecheckRulePlans({
|
|
32295
|
+
...params,
|
|
32296
|
+
workspaces: targets
|
|
32297
|
+
});
|
|
32298
|
+
if (params.profile) console.log(chalk.gray(` shared typecheck: 1 semantic owner · ${allTypeCheckedRuleNames.length} semantic rules · semantic cache off`));
|
|
32299
|
+
const structuralAction = async () => runLintNextPackages({
|
|
32300
|
+
...params,
|
|
32301
|
+
onPackageResult: ignorePackageResult,
|
|
32302
|
+
phase: "structural",
|
|
32303
|
+
typeCheckedRuleNames: allTypeCheckedRuleNames
|
|
32304
|
+
});
|
|
32305
|
+
const semanticAction = async () => {
|
|
32306
|
+
const sharedCache = createSharedValidateCache();
|
|
32307
|
+
const configOverride = resolvePackageConfigOverride(params.typeChecked, params.analyze ? void 0 : params.tierContext, params.analyzeTier);
|
|
32308
|
+
const repositoryGitignore = PATH.resolve(params.rootDir, ".gitignore");
|
|
32309
|
+
const gitignorePath = params.gitignore && existsSync(repositoryGitignore) ? repositoryGitignore : void 0;
|
|
32310
|
+
const results = [];
|
|
32311
|
+
for (const workspace of targets) {
|
|
32312
|
+
const rulePlan = plans.get(workspace.name) ?? {
|
|
32313
|
+
activeRuleNames: /* @__PURE__ */ new Set(),
|
|
32314
|
+
typeCheckedRuleNames: new Set(allTypeCheckedRuleNames)
|
|
32315
|
+
};
|
|
32316
|
+
results.push(await lintSemanticPackage({
|
|
32317
|
+
analyze: params.analyze,
|
|
32318
|
+
configOverride,
|
|
32319
|
+
fix: params.fix,
|
|
32320
|
+
gitignore: params.gitignore,
|
|
32321
|
+
gitignorePath,
|
|
32322
|
+
profile: params.profile,
|
|
32323
|
+
rulePlan,
|
|
32324
|
+
sharedCache,
|
|
32325
|
+
verbose: params.verbose,
|
|
32326
|
+
workspace: {
|
|
32327
|
+
...workspace,
|
|
32328
|
+
location: PATH.resolve(params.rootDir, workspace.location)
|
|
32329
|
+
}
|
|
32330
|
+
}));
|
|
32331
|
+
}
|
|
32332
|
+
if (params.profile) {
|
|
32333
|
+
const heapMiB = Math.round(process.memoryUsage().heapUsed / 1024 / 1024);
|
|
32334
|
+
console.log(chalk.gray(` shared TypeScript sources: ${sharedCache.sourceFiles.size} · semantic heap: ${heapMiB} MiB`));
|
|
32335
|
+
}
|
|
32336
|
+
return results;
|
|
32337
|
+
};
|
|
32338
|
+
let semanticResults;
|
|
32339
|
+
let structuralResults;
|
|
32340
|
+
if (params.fix) {
|
|
32341
|
+
structuralResults = await structuralAction();
|
|
32342
|
+
semanticResults = await semanticAction();
|
|
32343
|
+
} else [structuralResults, semanticResults] = await Promise.all([structuralAction(), semanticAction()]);
|
|
32344
|
+
const semanticByPackage = new Map(semanticResults.map((result) => [result.pkg, result]));
|
|
32345
|
+
const merged = structuralResults.map((result) => mergePackageResults(result, semanticByPackage.get(result.pkg)));
|
|
32346
|
+
const mergedByPackage = new Map(merged.map((result) => [result.pkg, result]));
|
|
32347
|
+
for (const [index, workspace] of targets.entries()) {
|
|
32348
|
+
const result = mergedByPackage.get(workspace.name);
|
|
32349
|
+
if (result !== void 0) params.onPackageResult(index, targets.length, result);
|
|
32350
|
+
}
|
|
32351
|
+
return merged;
|
|
32352
|
+
}
|
|
32353
|
+
//#endregion
|
|
31905
32354
|
//#region ../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
|
|
31906
32355
|
var Node = class {
|
|
31907
32356
|
value;
|
|
@@ -32579,7 +33028,10 @@ function logLintProfileHeader(cache, gitignore, typeChecked, detectedContext, me
|
|
|
32579
33028
|
console.log(chalk.gray(` type-checked: ${typeCheckedLabel}`));
|
|
32580
33029
|
console.log(chalk.gray(` meta packages: ${meta} · skip empty: ${skipEmpty ? "on" : "off"}`));
|
|
32581
33030
|
}
|
|
32582
|
-
|
|
33031
|
+
function runLintModePackages(mode, params) {
|
|
33032
|
+
return mode === "shared-typecheck" ? runLintSharedTypecheckPackages(params) : runLintNextPackages(params);
|
|
33033
|
+
}
|
|
33034
|
+
async function lintNext({ analyze = false, cache = true, cycleDepth, fix = false, gitignore = true, jobs, meta = "full", mode = "package-workers", pkg, profile = false, skipEmpty = true, typeChecked = "auto", verbose = false, workspaces: targetWorkspaces }) {
|
|
32583
33035
|
const rootDir = INIT_CWD();
|
|
32584
33036
|
const { analyzeContext, detectedContext, tierContext } = resolveTierForLint(analyze, rootDir);
|
|
32585
33037
|
if (analyzeContext.kind === "invalid") return resultFromExitCode(1);
|
|
@@ -32590,12 +33042,15 @@ async function lintNext({ analyze = false, cache = true, cycleDepth, fix = false
|
|
|
32590
33042
|
const analyzeStarted = Date.now();
|
|
32591
33043
|
const label = getLintLabel(analyze, fix, cycleDepth);
|
|
32592
33044
|
if (analyze && tierContext !== void 0) printAnalyzeRunHeader(workspaces);
|
|
32593
|
-
if (profile)
|
|
33045
|
+
if (profile) {
|
|
33046
|
+
console.log(chalk.gray(` lint mode: ${mode}`));
|
|
33047
|
+
logLintProfileHeader(cache, gitignore, typeChecked, detectedContext, meta, skipEmpty);
|
|
33048
|
+
}
|
|
32594
33049
|
return finishLintNext({
|
|
32595
33050
|
analyze,
|
|
32596
33051
|
analyzeStarted,
|
|
32597
33052
|
profile,
|
|
32598
|
-
results: await
|
|
33053
|
+
results: await runLintModePackages(mode, {
|
|
32599
33054
|
analyze,
|
|
32600
33055
|
analyzeTier,
|
|
32601
33056
|
cache,
|
|
@@ -32634,11 +33089,12 @@ function shouldUseIncremental$2(incremental) {
|
|
|
32634
33089
|
function shouldUseIncrementalLint({ analyze, fix, incremental, pkg }) {
|
|
32635
33090
|
return pkg === void 0 && fix !== true && analyze !== true && shouldUseIncremental$2(incremental);
|
|
32636
33091
|
}
|
|
32637
|
-
function lintOptionsHash({ cycleDepth, gitignore }) {
|
|
33092
|
+
function lintOptionsHash({ cycleDepth, gitignore, mode = defaultLintMode }) {
|
|
32638
33093
|
const gitignorePath = PATH.resolve(INIT_CWD(), ".gitignore");
|
|
32639
33094
|
return {
|
|
32640
33095
|
cycleDepth,
|
|
32641
33096
|
gitignore: gitignore === false ? false : existsSync(gitignorePath) ? readFileSync(gitignorePath, "utf8") : null,
|
|
33097
|
+
mode,
|
|
32642
33098
|
strict: isStrictMode()
|
|
32643
33099
|
};
|
|
32644
33100
|
}
|
|
@@ -32646,7 +33102,7 @@ const lintPackage = ({ pkg, fix, verbose }) => {
|
|
|
32646
33102
|
const pm = getPackageManager();
|
|
32647
33103
|
return runSteps(`${fix ?? false ? "Fix" : "Lint"} [${pkg}]`, [pm.runInWorkspace(pkg, fix ?? false ? "package-fix" : verbose ?? false ? "package-lint-verbose" : "package-lint")]);
|
|
32648
33104
|
};
|
|
32649
|
-
async function lintIncremental({ cache, cycleDepth, fix, gitignore, jobs, meta, profile, skipEmpty, typeChecked, verbose, workspaces: targetWorkspaces }) {
|
|
33105
|
+
async function lintIncremental({ cache, cycleDepth, fix, gitignore, jobs, meta, mode, profile, skipEmpty, typeChecked, verbose, workspaces: targetWorkspaces }) {
|
|
32650
33106
|
const pm = getPackageManager();
|
|
32651
33107
|
const allWorkspaces = targetWorkspaces ?? pm.listWorkspaces();
|
|
32652
33108
|
if (allWorkspaces.length === 0) return await lintNext({
|
|
@@ -32656,6 +33112,7 @@ async function lintIncremental({ cache, cycleDepth, fix, gitignore, jobs, meta,
|
|
|
32656
33112
|
gitignore,
|
|
32657
33113
|
jobs,
|
|
32658
33114
|
meta,
|
|
33115
|
+
mode,
|
|
32659
33116
|
profile,
|
|
32660
33117
|
skipEmpty,
|
|
32661
33118
|
typeChecked,
|
|
@@ -32665,7 +33122,8 @@ async function lintIncremental({ cache, cycleDepth, fix, gitignore, jobs, meta,
|
|
|
32665
33122
|
action: "lint",
|
|
32666
33123
|
options: lintOptionsHash({
|
|
32667
33124
|
cycleDepth,
|
|
32668
|
-
gitignore
|
|
33125
|
+
gitignore,
|
|
33126
|
+
mode
|
|
32669
33127
|
}),
|
|
32670
33128
|
pm,
|
|
32671
33129
|
isVerbose: verbose,
|
|
@@ -32678,7 +33136,8 @@ async function lintIncremental({ cache, cycleDepth, fix, gitignore, jobs, meta,
|
|
|
32678
33136
|
action: "lint",
|
|
32679
33137
|
options: lintOptionsHash({
|
|
32680
33138
|
cycleDepth,
|
|
32681
|
-
gitignore
|
|
33139
|
+
gitignore,
|
|
33140
|
+
mode
|
|
32682
33141
|
}),
|
|
32683
33142
|
pm,
|
|
32684
33143
|
workspaces: allWorkspaces
|
|
@@ -32692,6 +33151,7 @@ async function lintIncremental({ cache, cycleDepth, fix, gitignore, jobs, meta,
|
|
|
32692
33151
|
gitignore,
|
|
32693
33152
|
jobs,
|
|
32694
33153
|
meta,
|
|
33154
|
+
mode,
|
|
32695
33155
|
profile,
|
|
32696
33156
|
skipEmpty,
|
|
32697
33157
|
typeChecked,
|
|
@@ -32702,19 +33162,25 @@ async function lintIncremental({ cache, cycleDepth, fix, gitignore, jobs, meta,
|
|
|
32702
33162
|
action: "lint",
|
|
32703
33163
|
options: lintOptionsHash({
|
|
32704
33164
|
cycleDepth,
|
|
32705
|
-
gitignore
|
|
33165
|
+
gitignore,
|
|
33166
|
+
mode
|
|
32706
33167
|
}),
|
|
32707
33168
|
pm,
|
|
32708
33169
|
workspaces: allWorkspaces
|
|
32709
33170
|
});
|
|
32710
33171
|
return result;
|
|
32711
33172
|
}
|
|
32712
|
-
const lint = ({ analyze, cache, cycleDepth, fix, gitignore, incremental, jobs, meta, prev, pkg, profile, skipEmpty, typeChecked, verbose, workspaces }) => {
|
|
33173
|
+
const lint = ({ analyze, cache, cycleDepth, fix, gitignore, incremental, jobs, meta, mode, next, prev, pkg, profile, skipEmpty, typeChecked, verbose, workspaces }) => {
|
|
32713
33174
|
if (analyze === true && fix === true) {
|
|
32714
33175
|
console.error("The --analyze option cannot be combined with --fix");
|
|
32715
33176
|
return 1;
|
|
32716
33177
|
}
|
|
32717
|
-
|
|
33178
|
+
const resolvedMode = resolveLintMode({
|
|
33179
|
+
mode,
|
|
33180
|
+
next,
|
|
33181
|
+
prev
|
|
33182
|
+
}).mode;
|
|
33183
|
+
if (resolvedMode !== "workspace-eslint") {
|
|
32718
33184
|
if (shouldUseIncrementalLint({
|
|
32719
33185
|
analyze,
|
|
32720
33186
|
fix,
|
|
@@ -32727,6 +33193,7 @@ const lint = ({ analyze, cache, cycleDepth, fix, gitignore, incremental, jobs, m
|
|
|
32727
33193
|
gitignore,
|
|
32728
33194
|
jobs,
|
|
32729
33195
|
meta,
|
|
33196
|
+
mode: resolvedMode,
|
|
32730
33197
|
profile,
|
|
32731
33198
|
skipEmpty,
|
|
32732
33199
|
typeChecked,
|
|
@@ -32740,6 +33207,7 @@ const lint = ({ analyze, cache, cycleDepth, fix, gitignore, incremental, jobs, m
|
|
|
32740
33207
|
gitignore,
|
|
32741
33208
|
jobs,
|
|
32742
33209
|
meta,
|
|
33210
|
+
mode: resolvedMode,
|
|
32743
33211
|
pkg,
|
|
32744
33212
|
profile,
|
|
32745
33213
|
skipEmpty,
|
|
@@ -44251,8 +44719,13 @@ const relintPackage = ({ pkg, fix, verbose }) => {
|
|
|
44251
44719
|
const pm = getPackageManager();
|
|
44252
44720
|
return runSteps(`${fix ?? false ? "Fix" : "Lint"} [${pkg}]`, [pm.runInWorkspace(pkg, fix ?? false ? "package-fix" : verbose ?? false ? "package-lint-verbose" : "package-lint")]);
|
|
44253
44721
|
};
|
|
44254
|
-
const relint = ({ fix, gitignore, jobs, pkg, prev, verbose }) => {
|
|
44255
|
-
|
|
44722
|
+
const relint = ({ fix, gitignore, jobs, mode, next, pkg, prev, verbose }) => {
|
|
44723
|
+
const resolvedMode = resolveLintMode({
|
|
44724
|
+
mode,
|
|
44725
|
+
next,
|
|
44726
|
+
prev
|
|
44727
|
+
}).mode;
|
|
44728
|
+
if (resolvedMode !== "workspace-eslint") {
|
|
44256
44729
|
cleanLintCaches(pkg);
|
|
44257
44730
|
clearIncrementalSnapshot("lint");
|
|
44258
44731
|
return lint({
|
|
@@ -44261,6 +44734,7 @@ const relint = ({ fix, gitignore, jobs, pkg, prev, verbose }) => {
|
|
|
44261
44734
|
gitignore,
|
|
44262
44735
|
incremental: true,
|
|
44263
44736
|
jobs,
|
|
44737
|
+
mode: resolvedMode,
|
|
44264
44738
|
pkg,
|
|
44265
44739
|
verbose
|
|
44266
44740
|
});
|
|
@@ -55945,14 +56419,20 @@ const runCommand = {
|
|
|
55945
56419
|
default: true,
|
|
55946
56420
|
description: "Ignore files matched by the repository root .gitignore (disable with --no-gitignore)",
|
|
55947
56421
|
type: "boolean"
|
|
56422
|
+
}).option("mode", {
|
|
56423
|
+
choices: lintModes,
|
|
56424
|
+
default: defaultLintMode,
|
|
56425
|
+
description: "Lint implementation: package workers, shared type-checking, or workspace ESLint",
|
|
56426
|
+
type: "string"
|
|
55948
56427
|
}).option("next", {
|
|
55949
56428
|
default: false,
|
|
55950
|
-
description: "Deprecated:
|
|
56429
|
+
description: "Deprecated: use --mode package-workers",
|
|
55951
56430
|
hidden: true,
|
|
55952
56431
|
type: "boolean"
|
|
55953
56432
|
}).option("prev", {
|
|
55954
56433
|
default: false,
|
|
55955
|
-
description: "
|
|
56434
|
+
description: "Deprecated: use --mode workspace-eslint",
|
|
56435
|
+
hidden: true,
|
|
55956
56436
|
type: "boolean"
|
|
55957
56437
|
}).option("analyze", {
|
|
55958
56438
|
default: false,
|
|
@@ -55985,12 +56465,18 @@ const runCommand = {
|
|
|
55985
56465
|
await withEnvelope("lint rules", async () => ruleCatalogResult(await getEslintRuleCatalog("lint"), RULE_COMMANDS.lint.title));
|
|
55986
56466
|
return;
|
|
55987
56467
|
}
|
|
56468
|
+
const resolvedMode = resolveLintMode({
|
|
56469
|
+
mode: argv.mode,
|
|
56470
|
+
next: argv.next,
|
|
56471
|
+
prev: argv.prev
|
|
56472
|
+
});
|
|
56473
|
+
if (resolvedMode.legacyOption !== void 0) console.warn(chalk.yellow(`Deprecated: "${resolvedMode.legacyOption}" is deprecated; use "--mode ${resolvedMode.mode}" instead.`));
|
|
55988
56474
|
if (Boolean(argv.fresh)) {
|
|
55989
56475
|
await withEnvelope("lint", () => relint({
|
|
55990
56476
|
gitignore: argv.gitignore,
|
|
55991
56477
|
jobs: argv.jobs,
|
|
56478
|
+
mode: resolvedMode.mode,
|
|
55992
56479
|
pkg: argv.package,
|
|
55993
|
-
prev: argv.prev,
|
|
55994
56480
|
verbose: !!Boolean(argv.verbose)
|
|
55995
56481
|
}));
|
|
55996
56482
|
return;
|
|
@@ -56004,7 +56490,7 @@ const runCommand = {
|
|
|
56004
56490
|
incremental: argv.incremental !== false,
|
|
56005
56491
|
jobs: argv.jobs,
|
|
56006
56492
|
meta: argv.meta,
|
|
56007
|
-
|
|
56493
|
+
mode: resolvedMode.mode,
|
|
56008
56494
|
pkg: argv.package,
|
|
56009
56495
|
profile: argv.profile,
|
|
56010
56496
|
skipEmpty: argv["skip-empty"],
|
|
@@ -56150,15 +56636,21 @@ const relintCommand = {
|
|
|
56150
56636
|
command: "relint [package]",
|
|
56151
56637
|
describe: "Deprecated: use \"xy lint --fresh\"",
|
|
56152
56638
|
builder: (yargs) => {
|
|
56153
|
-
return packagePositionalParam(yargs).option("
|
|
56639
|
+
return packagePositionalParam(yargs).option("mode", {
|
|
56640
|
+
choices: lintModes,
|
|
56641
|
+
default: defaultLintMode,
|
|
56642
|
+
description: "Lint implementation: package workers, shared type-checking, or workspace ESLint",
|
|
56643
|
+
type: "string"
|
|
56644
|
+
}).option("next", {
|
|
56154
56645
|
alias: "n",
|
|
56155
56646
|
default: false,
|
|
56156
|
-
description: "Deprecated:
|
|
56647
|
+
description: "Deprecated: use --mode package-workers",
|
|
56157
56648
|
hidden: true,
|
|
56158
56649
|
type: "boolean"
|
|
56159
56650
|
}).option("prev", {
|
|
56160
56651
|
default: false,
|
|
56161
|
-
description: "
|
|
56652
|
+
description: "Deprecated: use --mode workspace-eslint",
|
|
56653
|
+
hidden: true,
|
|
56162
56654
|
type: "boolean"
|
|
56163
56655
|
}).option("rules", {
|
|
56164
56656
|
default: false,
|
|
@@ -56173,10 +56665,16 @@ const relintCommand = {
|
|
|
56173
56665
|
await withEnvelope("lint rules", async () => ruleCatalogResult(await getEslintRuleCatalog("lint"), RULE_COMMANDS.lint.title));
|
|
56174
56666
|
return;
|
|
56175
56667
|
}
|
|
56668
|
+
const resolvedMode = resolveLintMode({
|
|
56669
|
+
mode: argv.mode,
|
|
56670
|
+
next: argv.next,
|
|
56671
|
+
prev: argv.prev
|
|
56672
|
+
});
|
|
56673
|
+
if (resolvedMode.legacyOption !== void 0) console.warn(chalk.yellow(`Deprecated: "${resolvedMode.legacyOption}" is deprecated; use "--mode ${resolvedMode.mode}" instead.`));
|
|
56176
56674
|
await withEnvelope("lint", () => relint({
|
|
56177
56675
|
jobs: argv.jobs,
|
|
56676
|
+
mode: resolvedMode.mode,
|
|
56178
56677
|
pkg: argv.package,
|
|
56179
|
-
prev: argv.prev,
|
|
56180
56678
|
verbose: !!Boolean(argv.verbose)
|
|
56181
56679
|
}));
|
|
56182
56680
|
}
|