chore: migrate to oxlint and oxfmt

Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
Peter Steinberger
2026-01-14 14:31:43 +00:00
parent 912ebffc63
commit c379191f80
1480 changed files with 28608 additions and 43547 deletions

View File

@@ -56,9 +56,9 @@ async function main() {
setVerbose(hasFlag(args, "--verbose"));
const wsLogRaw = (
hasFlag(args, "--compact") ? "compact" : argValue(args, "--ws-log")
) as string | undefined;
const wsLogRaw = (hasFlag(args, "--compact") ? "compact" : argValue(args, "--ws-log")) as
| string
| undefined;
const wsLogStyle: GatewayWsLogStyle =
wsLogRaw === "compact" ? "compact" : wsLogRaw === "full" ? "full" : "auto";
setGatewayWsLogStyle(wsLogStyle);
@@ -81,16 +81,11 @@ async function main() {
cfg.gateway?.bind ??
"loopback";
const bind =
bindRaw === "loopback" ||
bindRaw === "lan" ||
bindRaw === "auto" ||
bindRaw === "custom"
bindRaw === "loopback" || bindRaw === "lan" || bindRaw === "auto" || bindRaw === "custom"
? bindRaw
: null;
if (!bind) {
defaultRuntime.error(
'Invalid --bind (use "loopback", "lan", "auto", or "custom")',
);
defaultRuntime.error('Invalid --bind (use "loopback", "lan", "auto", or "custom")');
process.exit(1);
}
@@ -110,9 +105,7 @@ async function main() {
const request = (action: "stop" | "restart", signal: string) => {
if (shuttingDown) {
defaultRuntime.log(
`gateway: received ${signal} during shutdown; ignoring`,
);
defaultRuntime.log(`gateway: received ${signal} during shutdown; ignoring`);
return;
}
shuttingDown = true;
@@ -122,9 +115,7 @@ async function main() {
);
forceExitTimer = setTimeout(() => {
defaultRuntime.error(
"gateway: shutdown timed out; exiting without full cleanup",
);
defaultRuntime.error("gateway: shutdown timed out; exiting without full cleanup");
cleanupSignals();
process.exit(0);
}, 5000);

View File

@@ -16,15 +16,11 @@ describe("parseRelaySmokeTest", () => {
it("parses env var smoke mode only when no args", () => {
expect(parseRelaySmokeTest([], { CLAWDBOT_SMOKE_QR: "1" })).toBe("qr");
expect(parseRelaySmokeTest(["send"], { CLAWDBOT_SMOKE_QR: "1" })).toBe(
null,
);
expect(parseRelaySmokeTest(["send"], { CLAWDBOT_SMOKE_QR: "1" })).toBe(null);
});
it("rejects unknown smoke values", () => {
expect(() => parseRelaySmokeTest(["--smoke", "nope"], {})).toThrow(
"Unknown smoke test",
);
expect(() => parseRelaySmokeTest(["--smoke", "nope"], {})).toThrow("Unknown smoke test");
});
});

View File

@@ -1,9 +1,6 @@
export type RelaySmokeTest = "qr";
export function parseRelaySmokeTest(
args: string[],
env: NodeJS.ProcessEnv,
): RelaySmokeTest | null {
export function parseRelaySmokeTest(args: string[], env: NodeJS.ProcessEnv): RelaySmokeTest | null {
const smokeIdx = args.indexOf("--smoke");
if (smokeIdx !== -1) {
const value = args[smokeIdx + 1];
@@ -18,10 +15,7 @@ export function parseRelaySmokeTest(
// Back-compat: only run env-based smoke mode when no CLI args are present,
// to avoid surprising early-exit when users set env vars globally.
if (
args.length === 0 &&
(env.CLAWDBOT_SMOKE_QR === "1" || env.CLAWDBOT_SMOKE === "qr")
) {
if (args.length === 0 && (env.CLAWDBOT_SMOKE_QR === "1" || env.CLAWDBOT_SMOKE === "qr")) {
return "qr";
}

View File

@@ -25,18 +25,12 @@ async function main() {
const args = process.argv.slice(2);
// Swift side expects `--version` to return a plain semver string.
if (
hasFlag(args, "--version") ||
hasFlag(args, "-V") ||
hasFlag(args, "-v")
) {
if (hasFlag(args, "--version") || hasFlag(args, "-V") || hasFlag(args, "-v")) {
console.log(BUNDLED_VERSION);
process.exit(0);
}
const { parseRelaySmokeTest, runRelaySmokeTest } = await import(
"./relay-smoke.js"
);
const { parseRelaySmokeTest, runRelaySmokeTest } = await import("./relay-smoke.js");
const smokeTest = parseRelaySmokeTest(args, process.env);
if (smokeTest) {
try {
@@ -61,9 +55,7 @@ async function main() {
const { assertSupportedRuntime } = await import("../infra/runtime-guard.js");
assertSupportedRuntime();
const { installUnhandledRejectionHandler } = await import(
"../infra/unhandled-rejections.js"
);
const { installUnhandledRejectionHandler } = await import("../infra/unhandled-rejections.js");
const { buildProgram } = await import("../cli/program.js");
const program = buildProgram();
@@ -71,10 +63,7 @@ async function main() {
installUnhandledRejectionHandler();
process.on("uncaughtException", (error) => {
console.error(
"[clawdbot] Uncaught exception:",
error.stack ?? error.message,
);
console.error("[clawdbot] Uncaught exception:", error.stack ?? error.message);
process.exit(1);
});