fix(lint): skip heavy-check lock for extra metadata commands

This commit is contained in:
Vincent Koc
2026-04-12 05:39:34 +01:00
parent 33929c477c
commit 812e493ef5
2 changed files with 22 additions and 2 deletions

View File

@@ -92,7 +92,18 @@ export function shouldAcquireLocalHeavyCheckLockForOxlint(
return true;
}
if (args.some((arg) => arg === "--help" || arg === "-h" || arg === "--version" || arg === "-V")) {
if (
args.some(
(arg) =>
arg === "--help" ||
arg === "-h" ||
arg === "--version" ||
arg === "-V" ||
arg === "--rules" ||
arg === "--print-config" ||
arg === "--init",
)
) {
return false;
}
@@ -125,7 +136,12 @@ export function shouldAcquireLocalHeavyCheckLockForTsgo(args, env = process.env)
return !args.some(
(arg) =>
arg === "--help" || arg === "-h" || arg === "--version" || arg === "-v" || arg === "--init",
arg === "--help" ||
arg === "-h" ||
arg === "--version" ||
arg === "-v" ||
arg === "--init" ||
arg === "--showConfig",
);
}

View File

@@ -181,6 +181,7 @@ describe("local-heavy-check-runtime", () => {
expect(shouldAcquireLocalHeavyCheckLockForTsgo(["--version"])).toBe(false);
expect(shouldAcquireLocalHeavyCheckLockForTsgo(["-v"])).toBe(false);
expect(shouldAcquireLocalHeavyCheckLockForTsgo(["--init"])).toBe(false);
expect(shouldAcquireLocalHeavyCheckLockForTsgo(["--showConfig"])).toBe(false);
});
it("keeps the heavy-check lock for real tsgo runs", () => {
@@ -256,6 +257,9 @@ describe("local-heavy-check-runtime", () => {
expect(shouldAcquireLocalHeavyCheckLockForOxlint(["-h"])).toBe(false);
expect(shouldAcquireLocalHeavyCheckLockForOxlint(["--version"])).toBe(false);
expect(shouldAcquireLocalHeavyCheckLockForOxlint(["-V"])).toBe(false);
expect(shouldAcquireLocalHeavyCheckLockForOxlint(["--rules"])).toBe(false);
expect(shouldAcquireLocalHeavyCheckLockForOxlint(["--print-config"])).toBe(false);
expect(shouldAcquireLocalHeavyCheckLockForOxlint(["--init"])).toBe(false);
});
it("keeps the heavy-check lock for directory targets and broad oxlint runs", () => {