@xylabs/ts-scripts-yarn3 7.4.27 → 7.4.28
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/actions/index.mjs +311 -83
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/lintlint.mjs +230 -0
- package/dist/actions/lintlint.mjs.map +1 -0
- package/dist/bin/xy.mjs +295 -48
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.mjs +351 -103
- package/dist/index.mjs.map +1 -1
- package/dist/xy/index.mjs +295 -48
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/lint/index.mjs +285 -38
- package/dist/xy/lint/index.mjs.map +1 -1
- package/dist/xy/lint/lintlintCommand.mjs +250 -0
- package/dist/xy/lint/lintlintCommand.mjs.map +1 -0
- package/dist/xy/xy.mjs +295 -48
- package/dist/xy/xy.mjs.map +1 -1
- package/package.json +2 -2
package/dist/xy/lint/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/xy/lint/cycleCommand.ts
|
|
2
|
-
import
|
|
2
|
+
import chalk16 from "chalk";
|
|
3
3
|
|
|
4
4
|
// src/lib/checkResult.ts
|
|
5
5
|
import chalk from "chalk";
|
|
@@ -1021,10 +1021,237 @@ var knip = () => {
|
|
|
1021
1021
|
return runSteps("Knip", [["yarn", ["knip", "--dependencies", "--no-exit-code"]]]);
|
|
1022
1022
|
};
|
|
1023
1023
|
|
|
1024
|
-
// src/actions/
|
|
1024
|
+
// src/actions/lintlint.ts
|
|
1025
1025
|
import { readFileSync, writeFileSync } from "fs";
|
|
1026
1026
|
import PATH from "path";
|
|
1027
1027
|
import chalk13 from "chalk";
|
|
1028
|
+
import { findUp } from "find-up";
|
|
1029
|
+
function parseRuleValue(value) {
|
|
1030
|
+
if (typeof value === "string") {
|
|
1031
|
+
return { level: value };
|
|
1032
|
+
}
|
|
1033
|
+
if (typeof value === "number") {
|
|
1034
|
+
return { level: String(value) };
|
|
1035
|
+
}
|
|
1036
|
+
if (Array.isArray(value) && value.length > 0) {
|
|
1037
|
+
return {
|
|
1038
|
+
level: String(value[0]),
|
|
1039
|
+
options: value.length > 1 ? value.slice(1) : void 0
|
|
1040
|
+
};
|
|
1041
|
+
}
|
|
1042
|
+
return void 0;
|
|
1043
|
+
}
|
|
1044
|
+
function normalizeLevel(level) {
|
|
1045
|
+
if (level === "0" || level === "off") return "off";
|
|
1046
|
+
if (level === "1" || level === "warn") return "warn";
|
|
1047
|
+
if (level === "2" || level === "error") return "error";
|
|
1048
|
+
return level;
|
|
1049
|
+
}
|
|
1050
|
+
function rulesMatch(a, b) {
|
|
1051
|
+
if (normalizeLevel(a.level) !== normalizeLevel(b.level)) return false;
|
|
1052
|
+
return JSON.stringify(a.options) === JSON.stringify(b.options);
|
|
1053
|
+
}
|
|
1054
|
+
function formatRule(entry) {
|
|
1055
|
+
if (entry.options) {
|
|
1056
|
+
return JSON.stringify([entry.level, ...entry.options]);
|
|
1057
|
+
}
|
|
1058
|
+
return JSON.stringify([entry.level]);
|
|
1059
|
+
}
|
|
1060
|
+
function mergeRulesFromBlocks(blocks) {
|
|
1061
|
+
const merged = /* @__PURE__ */ new Map();
|
|
1062
|
+
for (const block of blocks) {
|
|
1063
|
+
if (!block.rules) continue;
|
|
1064
|
+
for (const [name, value] of Object.entries(block.rules)) {
|
|
1065
|
+
const parsed = parseRuleValue(value);
|
|
1066
|
+
if (parsed) merged.set(name, parsed);
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
return merged;
|
|
1070
|
+
}
|
|
1071
|
+
function detectSharedPackage(source) {
|
|
1072
|
+
if (source.includes("@xylabs/eslint-config-react-flat")) return "@xylabs/eslint-config-react-flat";
|
|
1073
|
+
if (source.includes("@xylabs/eslint-config-flat")) return "@xylabs/eslint-config-flat";
|
|
1074
|
+
return void 0;
|
|
1075
|
+
}
|
|
1076
|
+
function extractLocalRuleBlocks(source) {
|
|
1077
|
+
const blocks = [];
|
|
1078
|
+
const ruleBlockRegex = /\{\s*(?:files\s*:\s*\[.*?\]\s*,\s*)?rules\s*:\s*\{([^}]*(?:\{[^}]*\}[^}]*)*)\}/g;
|
|
1079
|
+
let match;
|
|
1080
|
+
while ((match = ruleBlockRegex.exec(source)) !== null) {
|
|
1081
|
+
blocks.push(match[1]);
|
|
1082
|
+
}
|
|
1083
|
+
return blocks;
|
|
1084
|
+
}
|
|
1085
|
+
function extractRulesFromSourceBlocks(blocks) {
|
|
1086
|
+
const rules2 = /* @__PURE__ */ new Map();
|
|
1087
|
+
for (const block of blocks) {
|
|
1088
|
+
const ruleRegex = /['"]([^'"]+)['"]\s*:\s*(\[[\s\S]*?\](?=\s*,|\s*$))/gm;
|
|
1089
|
+
let match;
|
|
1090
|
+
while ((match = ruleRegex.exec(block)) !== null) {
|
|
1091
|
+
rules2.set(match[1], match[2]);
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
return rules2;
|
|
1095
|
+
}
|
|
1096
|
+
async function resolveSharedConfig(configDir, sharedPkg) {
|
|
1097
|
+
try {
|
|
1098
|
+
const sharedModule = await import(sharedPkg);
|
|
1099
|
+
const config2 = sharedModule.config ?? sharedModule.default;
|
|
1100
|
+
if (Array.isArray(config2)) return config2;
|
|
1101
|
+
return [];
|
|
1102
|
+
} catch {
|
|
1103
|
+
const distPath = PATH.resolve(configDir, "node_modules", sharedPkg, "dist", "node", "index.mjs");
|
|
1104
|
+
try {
|
|
1105
|
+
const sharedModule = await import(distPath);
|
|
1106
|
+
const config2 = sharedModule.config ?? sharedModule.default;
|
|
1107
|
+
if (Array.isArray(config2)) return config2;
|
|
1108
|
+
} catch {
|
|
1109
|
+
const neutralPath = PATH.resolve(configDir, "node_modules", sharedPkg, "dist", "neutral", "index.mjs");
|
|
1110
|
+
const sharedModule = await import(neutralPath);
|
|
1111
|
+
const config2 = sharedModule.config ?? sharedModule.default;
|
|
1112
|
+
if (Array.isArray(config2)) return config2;
|
|
1113
|
+
}
|
|
1114
|
+
return [];
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
async function loadSharedRules(configDir, sharedPkg, verbose) {
|
|
1118
|
+
const sharedBlocks = await resolveSharedConfig(configDir, sharedPkg);
|
|
1119
|
+
const sharedRules = mergeRulesFromBlocks(sharedBlocks);
|
|
1120
|
+
if (verbose) {
|
|
1121
|
+
console.log(chalk13.gray(`Shared config defines ${sharedRules.size} rules`));
|
|
1122
|
+
}
|
|
1123
|
+
if (sharedRules.size === 0) {
|
|
1124
|
+
console.error(chalk13.red("Could not load rules from shared config. Is it installed and built?"));
|
|
1125
|
+
return void 0;
|
|
1126
|
+
}
|
|
1127
|
+
return sharedRules;
|
|
1128
|
+
}
|
|
1129
|
+
async function loadLocalRules(eslintConfigPath, source, verbose) {
|
|
1130
|
+
const localModule = await import(eslintConfigPath);
|
|
1131
|
+
const localConfig = localModule.default ?? localModule;
|
|
1132
|
+
const localBlocks = Array.isArray(localConfig) ? localConfig : [localConfig];
|
|
1133
|
+
const resolved = mergeRulesFromBlocks(localBlocks);
|
|
1134
|
+
const localRuleBlocks = extractLocalRuleBlocks(source);
|
|
1135
|
+
const explicit = extractRulesFromSourceBlocks(localRuleBlocks);
|
|
1136
|
+
if (verbose) {
|
|
1137
|
+
console.log(chalk13.gray(`Local config has ${explicit.size} explicit rule setting(s)`));
|
|
1138
|
+
}
|
|
1139
|
+
return { explicit, resolved };
|
|
1140
|
+
}
|
|
1141
|
+
function compareRules(explicitRuleNames, allResolvedRules, sharedRules) {
|
|
1142
|
+
const redundant = [];
|
|
1143
|
+
const overrides = [];
|
|
1144
|
+
const additions = [];
|
|
1145
|
+
for (const ruleName of explicitRuleNames.keys()) {
|
|
1146
|
+
const resolvedEntry = allResolvedRules.get(ruleName);
|
|
1147
|
+
const sharedEntry = sharedRules.get(ruleName);
|
|
1148
|
+
if (!resolvedEntry) continue;
|
|
1149
|
+
if (!sharedEntry) {
|
|
1150
|
+
additions.push({ local: resolvedEntry, rule: ruleName });
|
|
1151
|
+
} else if (rulesMatch(resolvedEntry, sharedEntry)) {
|
|
1152
|
+
redundant.push({
|
|
1153
|
+
local: resolvedEntry,
|
|
1154
|
+
rule: ruleName,
|
|
1155
|
+
shared: sharedEntry
|
|
1156
|
+
});
|
|
1157
|
+
} else {
|
|
1158
|
+
overrides.push({
|
|
1159
|
+
local: resolvedEntry,
|
|
1160
|
+
rule: ruleName,
|
|
1161
|
+
shared: sharedEntry
|
|
1162
|
+
});
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
return {
|
|
1166
|
+
additions,
|
|
1167
|
+
overrides,
|
|
1168
|
+
redundant
|
|
1169
|
+
};
|
|
1170
|
+
}
|
|
1171
|
+
function reportResults({
|
|
1172
|
+
additions,
|
|
1173
|
+
overrides,
|
|
1174
|
+
redundant
|
|
1175
|
+
}, verbose) {
|
|
1176
|
+
if (redundant.length > 0) {
|
|
1177
|
+
console.log(chalk13.yellow(`
|
|
1178
|
+
${redundant.length} redundant rule(s) (same as shared config \u2014 can be removed):`));
|
|
1179
|
+
for (const { rule, local } of redundant) {
|
|
1180
|
+
console.log(chalk13.yellow(` ${rule}: ${formatRule(local)}`));
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
if (overrides.length > 0) {
|
|
1184
|
+
console.log(chalk13.cyan(`
|
|
1185
|
+
${overrides.length} rule override(s) (different from shared config):`));
|
|
1186
|
+
for (const {
|
|
1187
|
+
rule,
|
|
1188
|
+
local,
|
|
1189
|
+
shared
|
|
1190
|
+
} of overrides) {
|
|
1191
|
+
console.log(chalk13.cyan(` ${rule}:`));
|
|
1192
|
+
console.log(chalk13.gray(` shared: ${formatRule(shared)}`));
|
|
1193
|
+
console.log(chalk13.white(` local: ${formatRule(local)}`));
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
if (additions.length > 0 && verbose) {
|
|
1197
|
+
console.log(chalk13.gray(`
|
|
1198
|
+
${additions.length} local addition(s) (not in shared config):`));
|
|
1199
|
+
for (const { rule, local } of additions) {
|
|
1200
|
+
console.log(chalk13.gray(` ${rule}: ${formatRule(local)}`));
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
if (redundant.length === 0 && overrides.length === 0) {
|
|
1204
|
+
console.log(chalk13.green("No redundant or overridden rules found"));
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
function fixRedundantRules(eslintConfigPath, source, redundant) {
|
|
1208
|
+
let updated = source;
|
|
1209
|
+
for (const { rule } of redundant) {
|
|
1210
|
+
const escaped = rule.replaceAll("/", String.raw`\/`);
|
|
1211
|
+
const pattern = new RegExp(String.raw`[ \t]*['"]${escaped}['"]\s*:\s*\[[^\]]*\],?[ \t]*\n?`, "g");
|
|
1212
|
+
updated = updated.replace(pattern, "");
|
|
1213
|
+
}
|
|
1214
|
+
updated = updated.replaceAll(/\n{3,}/g, "\n\n");
|
|
1215
|
+
if (updated !== source) {
|
|
1216
|
+
writeFileSync(eslintConfigPath, updated, "utf8");
|
|
1217
|
+
console.log(chalk13.green(`
|
|
1218
|
+
Fixed: removed ${redundant.length} redundant rule(s)`));
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
async function lintlint({ fix: fix2, verbose } = {}) {
|
|
1222
|
+
const eslintConfigPath = await findUp("eslint.config.mjs");
|
|
1223
|
+
if (!eslintConfigPath) {
|
|
1224
|
+
console.error(chalk13.red("No eslint.config.mjs found"));
|
|
1225
|
+
return 1;
|
|
1226
|
+
}
|
|
1227
|
+
const configDir = PATH.dirname(eslintConfigPath);
|
|
1228
|
+
if (verbose) {
|
|
1229
|
+
console.log(chalk13.gray(`Found config: ${eslintConfigPath}`));
|
|
1230
|
+
}
|
|
1231
|
+
const source = readFileSync(eslintConfigPath, "utf8");
|
|
1232
|
+
const sharedPkg = detectSharedPackage(source);
|
|
1233
|
+
if (!sharedPkg) {
|
|
1234
|
+
console.log(chalk13.yellow("No @xylabs/eslint-config-flat or @xylabs/eslint-config-react-flat imports found"));
|
|
1235
|
+
return 0;
|
|
1236
|
+
}
|
|
1237
|
+
if (verbose) {
|
|
1238
|
+
console.log(chalk13.gray(`Shared package: ${sharedPkg}`));
|
|
1239
|
+
}
|
|
1240
|
+
const sharedRules = await loadSharedRules(configDir, sharedPkg, !!verbose);
|
|
1241
|
+
if (!sharedRules) return 1;
|
|
1242
|
+
const { explicit, resolved } = await loadLocalRules(eslintConfigPath, source, !!verbose);
|
|
1243
|
+
const results = compareRules(explicit, resolved, sharedRules);
|
|
1244
|
+
reportResults(results, !!verbose);
|
|
1245
|
+
if (results.redundant.length > 0 && fix2) {
|
|
1246
|
+
fixRedundantRules(eslintConfigPath, source, results.redundant);
|
|
1247
|
+
}
|
|
1248
|
+
return results.redundant.length > 0 && !fix2 ? 1 : 0;
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
// src/actions/package-lint.ts
|
|
1252
|
+
import { readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
1253
|
+
import PATH2 from "path";
|
|
1254
|
+
import chalk14 from "chalk";
|
|
1028
1255
|
import picomatch from "picomatch";
|
|
1029
1256
|
function emptyResult() {
|
|
1030
1257
|
return {
|
|
@@ -1034,12 +1261,12 @@ function emptyResult() {
|
|
|
1034
1261
|
};
|
|
1035
1262
|
}
|
|
1036
1263
|
function readRootPackageJson(cwd) {
|
|
1037
|
-
const raw =
|
|
1264
|
+
const raw = readFileSync2(PATH2.resolve(cwd, "package.json"), "utf8");
|
|
1038
1265
|
return JSON.parse(raw);
|
|
1039
1266
|
}
|
|
1040
1267
|
function writeRootPackageJson(cwd, pkg) {
|
|
1041
|
-
const path6 =
|
|
1042
|
-
|
|
1268
|
+
const path6 = PATH2.resolve(cwd, "package.json");
|
|
1269
|
+
writeFileSync2(path6, `${JSON.stringify(pkg, null, 2)}
|
|
1043
1270
|
`, "utf8");
|
|
1044
1271
|
}
|
|
1045
1272
|
function isMonorepo(pkg) {
|
|
@@ -1066,7 +1293,7 @@ function checkRootPrivate(pkg) {
|
|
|
1066
1293
|
function fixRootPrivate(cwd, pkg) {
|
|
1067
1294
|
pkg.private = true;
|
|
1068
1295
|
writeRootPackageJson(cwd, pkg);
|
|
1069
|
-
console.log(
|
|
1296
|
+
console.log(chalk14.green(' \u2714 Fixed: set "private": true in root package.json'));
|
|
1070
1297
|
}
|
|
1071
1298
|
function checkNoPublishConfigOnPrivate(pkg) {
|
|
1072
1299
|
const result = emptyResult();
|
|
@@ -1078,7 +1305,7 @@ function checkNoPublishConfigOnPrivate(pkg) {
|
|
|
1078
1305
|
function fixNoPublishConfigOnPrivate(cwd, pkg) {
|
|
1079
1306
|
delete pkg.publishConfig;
|
|
1080
1307
|
writeRootPackageJson(cwd, pkg);
|
|
1081
|
-
console.log(
|
|
1308
|
+
console.log(chalk14.green(" \u2714 Fixed: removed publishConfig from private root package.json"));
|
|
1082
1309
|
}
|
|
1083
1310
|
function checkDiscoverable(pkg, workspaces) {
|
|
1084
1311
|
const result = emptyResult();
|
|
@@ -1097,22 +1324,22 @@ function logResults(label, result, fix2) {
|
|
|
1097
1324
|
let errors = 0;
|
|
1098
1325
|
let fixed = 0;
|
|
1099
1326
|
for (const error of result.errors) {
|
|
1100
|
-
console.log(
|
|
1327
|
+
console.log(chalk14.red(` \u2717 ${error}`));
|
|
1101
1328
|
errors++;
|
|
1102
1329
|
}
|
|
1103
1330
|
for (const fixable of result.fixable) {
|
|
1104
1331
|
if (fix2) {
|
|
1105
1332
|
fixed++;
|
|
1106
1333
|
} else {
|
|
1107
|
-
console.log(
|
|
1334
|
+
console.log(chalk14.red(` \u2717 ${fixable} (fixable)`));
|
|
1108
1335
|
errors++;
|
|
1109
1336
|
}
|
|
1110
1337
|
}
|
|
1111
1338
|
for (const warning of result.warnings) {
|
|
1112
|
-
console.log(
|
|
1339
|
+
console.log(chalk14.yellow(` \u26A0 ${warning}`));
|
|
1113
1340
|
}
|
|
1114
1341
|
if (errors === 0 && fixed === 0 && result.warnings.length === 0) {
|
|
1115
|
-
console.log(
|
|
1342
|
+
console.log(chalk14.green(` \u2713 ${label}`));
|
|
1116
1343
|
}
|
|
1117
1344
|
return { errors, fixed };
|
|
1118
1345
|
}
|
|
@@ -1132,14 +1359,14 @@ function runChecks(entries, cwd, pkg, fix2) {
|
|
|
1132
1359
|
}
|
|
1133
1360
|
function logSummary(errors, fixed) {
|
|
1134
1361
|
if (fixed > 0) {
|
|
1135
|
-
console.log(
|
|
1362
|
+
console.log(chalk14.green(`
|
|
1136
1363
|
Fixed ${fixed} issue(s)`));
|
|
1137
1364
|
}
|
|
1138
1365
|
if (errors > 0) {
|
|
1139
|
-
console.log(
|
|
1366
|
+
console.log(chalk14.red(`
|
|
1140
1367
|
${errors} error(s) found`));
|
|
1141
1368
|
} else if (fixed === 0) {
|
|
1142
|
-
console.log(
|
|
1369
|
+
console.log(chalk14.green("\n All checks passed"));
|
|
1143
1370
|
}
|
|
1144
1371
|
}
|
|
1145
1372
|
function packageLintMonorepo(fix2 = false) {
|
|
@@ -1148,14 +1375,14 @@ function packageLintMonorepo(fix2 = false) {
|
|
|
1148
1375
|
try {
|
|
1149
1376
|
pkg = readRootPackageJson(cwd);
|
|
1150
1377
|
} catch {
|
|
1151
|
-
console.error(
|
|
1378
|
+
console.error(chalk14.red("Could not read package.json"));
|
|
1152
1379
|
return 1;
|
|
1153
1380
|
}
|
|
1154
1381
|
if (!isMonorepo(pkg)) {
|
|
1155
|
-
console.log(
|
|
1382
|
+
console.log(chalk14.gray("Not a monorepo \u2014 skipping package-lint checks"));
|
|
1156
1383
|
return 0;
|
|
1157
1384
|
}
|
|
1158
|
-
console.log(
|
|
1385
|
+
console.log(chalk14.green("Package Lint"));
|
|
1159
1386
|
const workspaces = yarnWorkspaces();
|
|
1160
1387
|
const checks = [
|
|
1161
1388
|
{
|
|
@@ -1189,13 +1416,13 @@ var publintAll = ({ verbose }) => {
|
|
|
1189
1416
|
};
|
|
1190
1417
|
|
|
1191
1418
|
// src/actions/relint.ts
|
|
1192
|
-
import
|
|
1419
|
+
import chalk15 from "chalk";
|
|
1193
1420
|
var relintPackage = ({
|
|
1194
1421
|
pkg,
|
|
1195
1422
|
fix: fix2,
|
|
1196
1423
|
verbose
|
|
1197
1424
|
}) => {
|
|
1198
|
-
console.log(
|
|
1425
|
+
console.log(chalk15.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1199
1426
|
const start = Date.now();
|
|
1200
1427
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1201
1428
|
["yarn", [
|
|
@@ -1205,7 +1432,7 @@ var relintPackage = ({
|
|
|
1205
1432
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
1206
1433
|
]]
|
|
1207
1434
|
]);
|
|
1208
|
-
console.log(
|
|
1435
|
+
console.log(chalk15.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk15.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk15.gray("seconds")}`));
|
|
1209
1436
|
return result;
|
|
1210
1437
|
};
|
|
1211
1438
|
var relint = ({
|
|
@@ -1225,13 +1452,13 @@ var relint = ({
|
|
|
1225
1452
|
});
|
|
1226
1453
|
};
|
|
1227
1454
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1228
|
-
console.log(
|
|
1455
|
+
console.log(chalk15.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1229
1456
|
const start = Date.now();
|
|
1230
1457
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1231
1458
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1232
1459
|
["yarn", ["eslint", ...fixOptions]]
|
|
1233
1460
|
]);
|
|
1234
|
-
console.log(
|
|
1461
|
+
console.log(chalk15.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk15.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk15.gray("seconds")}`));
|
|
1235
1462
|
return result;
|
|
1236
1463
|
};
|
|
1237
1464
|
|
|
@@ -1256,12 +1483,12 @@ var cycleCommand = {
|
|
|
1256
1483
|
const start = Date.now();
|
|
1257
1484
|
if (argv.verbose) console.log("Cycle");
|
|
1258
1485
|
process.exitCode = await cycle({ pkg: argv.package });
|
|
1259
|
-
console.log(
|
|
1486
|
+
console.log(chalk16.blue(`Finished in ${Date.now() - start}ms`));
|
|
1260
1487
|
}
|
|
1261
1488
|
};
|
|
1262
1489
|
|
|
1263
1490
|
// src/xy/lint/deplintCommand.ts
|
|
1264
|
-
import
|
|
1491
|
+
import chalk17 from "chalk";
|
|
1265
1492
|
var deplintCommand = {
|
|
1266
1493
|
command: "deplint [package]",
|
|
1267
1494
|
describe: "Deplint - Run Deplint",
|
|
@@ -1299,12 +1526,12 @@ var deplintCommand = {
|
|
|
1299
1526
|
peerDeps: !!argv.peerDeps,
|
|
1300
1527
|
verbose: !!argv.verbose
|
|
1301
1528
|
});
|
|
1302
|
-
console.log(
|
|
1529
|
+
console.log(chalk17.blue(`Finished in ${Date.now() - start}ms`));
|
|
1303
1530
|
}
|
|
1304
1531
|
};
|
|
1305
1532
|
|
|
1306
1533
|
// src/xy/lint/fixCommand.ts
|
|
1307
|
-
import
|
|
1534
|
+
import chalk18 from "chalk";
|
|
1308
1535
|
var fixCommand = {
|
|
1309
1536
|
command: "fix [package]",
|
|
1310
1537
|
describe: "Fix - Run Eslint w/fix",
|
|
@@ -1315,12 +1542,12 @@ var fixCommand = {
|
|
|
1315
1542
|
const start = Date.now();
|
|
1316
1543
|
if (argv.verbose) console.log("Fix");
|
|
1317
1544
|
process.exitCode = fix();
|
|
1318
|
-
console.log(
|
|
1545
|
+
console.log(chalk18.blue(`Finished in ${Date.now() - start}ms`));
|
|
1319
1546
|
}
|
|
1320
1547
|
};
|
|
1321
1548
|
|
|
1322
1549
|
// src/xy/lint/knipCommand.ts
|
|
1323
|
-
import
|
|
1550
|
+
import chalk19 from "chalk";
|
|
1324
1551
|
var knipCommand = {
|
|
1325
1552
|
command: "knip",
|
|
1326
1553
|
describe: "Knip - Run Knip",
|
|
@@ -1331,12 +1558,12 @@ var knipCommand = {
|
|
|
1331
1558
|
if (argv.verbose) console.log("Knip");
|
|
1332
1559
|
const start = Date.now();
|
|
1333
1560
|
process.exitCode = knip();
|
|
1334
|
-
console.log(
|
|
1561
|
+
console.log(chalk19.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
1335
1562
|
}
|
|
1336
1563
|
};
|
|
1337
1564
|
|
|
1338
1565
|
// src/xy/lint/lintCommand.ts
|
|
1339
|
-
import
|
|
1566
|
+
import chalk20 from "chalk";
|
|
1340
1567
|
var lintCommand = {
|
|
1341
1568
|
command: "lint [package]",
|
|
1342
1569
|
describe: "Lint - Run Eslint",
|
|
@@ -1365,7 +1592,27 @@ var lintCommand = {
|
|
|
1365
1592
|
cache: argv.cache,
|
|
1366
1593
|
verbose: !!argv.verbose
|
|
1367
1594
|
});
|
|
1368
|
-
console.log(
|
|
1595
|
+
console.log(chalk20.blue(`Finished in ${Date.now() - start}ms`));
|
|
1596
|
+
}
|
|
1597
|
+
};
|
|
1598
|
+
|
|
1599
|
+
// src/xy/lint/lintlintCommand.ts
|
|
1600
|
+
var lintlintCommand = {
|
|
1601
|
+
command: "lintlint",
|
|
1602
|
+
describe: "Lint Lint - Check for redundant or overridden ESLint rules vs shared config",
|
|
1603
|
+
builder: (yargs) => {
|
|
1604
|
+
return yargs.option("fix", {
|
|
1605
|
+
default: false,
|
|
1606
|
+
description: "Remove redundant rules from local config",
|
|
1607
|
+
type: "boolean"
|
|
1608
|
+
});
|
|
1609
|
+
},
|
|
1610
|
+
handler: async (argv) => {
|
|
1611
|
+
if (argv.verbose) console.log("Lint Lint");
|
|
1612
|
+
process.exitCode = await lintlint({
|
|
1613
|
+
fix: argv.fix,
|
|
1614
|
+
verbose: !!argv.verbose
|
|
1615
|
+
});
|
|
1369
1616
|
}
|
|
1370
1617
|
};
|
|
1371
1618
|
|
|
@@ -1387,7 +1634,7 @@ var packageLintCommand = {
|
|
|
1387
1634
|
};
|
|
1388
1635
|
|
|
1389
1636
|
// src/xy/lint/publintCommand.ts
|
|
1390
|
-
import
|
|
1637
|
+
import chalk21 from "chalk";
|
|
1391
1638
|
var publintCommand = {
|
|
1392
1639
|
command: "publint [package]",
|
|
1393
1640
|
describe: "Publint - Run Publint",
|
|
@@ -1398,12 +1645,12 @@ var publintCommand = {
|
|
|
1398
1645
|
if (argv.verbose) console.log("Publint");
|
|
1399
1646
|
const start = Date.now();
|
|
1400
1647
|
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
1401
|
-
console.log(
|
|
1648
|
+
console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
|
|
1402
1649
|
}
|
|
1403
1650
|
};
|
|
1404
1651
|
|
|
1405
1652
|
// src/xy/lint/relintCommand.ts
|
|
1406
|
-
import
|
|
1653
|
+
import chalk22 from "chalk";
|
|
1407
1654
|
var relintCommand = {
|
|
1408
1655
|
command: "relint [package]",
|
|
1409
1656
|
describe: "Relint - Clean & Lint",
|
|
@@ -1414,12 +1661,12 @@ var relintCommand = {
|
|
|
1414
1661
|
if (argv.verbose) console.log("Relinting");
|
|
1415
1662
|
const start = Date.now();
|
|
1416
1663
|
process.exitCode = relint();
|
|
1417
|
-
console.log(
|
|
1664
|
+
console.log(chalk22.blue(`Finished in ${Date.now() - start}ms`));
|
|
1418
1665
|
}
|
|
1419
1666
|
};
|
|
1420
1667
|
|
|
1421
1668
|
// src/xy/lint/sonarCommand.ts
|
|
1422
|
-
import
|
|
1669
|
+
import chalk23 from "chalk";
|
|
1423
1670
|
var sonarCommand = {
|
|
1424
1671
|
command: "sonar",
|
|
1425
1672
|
describe: "Sonar - Run Sonar Check",
|
|
@@ -1430,13 +1677,13 @@ var sonarCommand = {
|
|
|
1430
1677
|
const start = Date.now();
|
|
1431
1678
|
if (argv.verbose) console.log("Sonar Check");
|
|
1432
1679
|
process.exitCode = sonar();
|
|
1433
|
-
console.log(
|
|
1680
|
+
console.log(chalk23.blue(`Finished in ${Date.now() - start}ms`));
|
|
1434
1681
|
}
|
|
1435
1682
|
};
|
|
1436
1683
|
|
|
1437
1684
|
// src/xy/lint/index.ts
|
|
1438
1685
|
var xyLintCommands = (args) => {
|
|
1439
|
-
return args.command(cycleCommand).command(lintCommand).command(deplintCommand).command(fixCommand).command(relintCommand).command(publintCommand).command(knipCommand).command(packageLintCommand).command(sonarCommand);
|
|
1686
|
+
return args.command(cycleCommand).command(lintCommand).command(lintlintCommand).command(deplintCommand).command(fixCommand).command(relintCommand).command(publintCommand).command(knipCommand).command(packageLintCommand).command(sonarCommand);
|
|
1440
1687
|
};
|
|
1441
1688
|
export {
|
|
1442
1689
|
xyLintCommands
|