From baa1e95b9d9401c5916e0218e42196a8edc0e5e2 Mon Sep 17 00:00:00 2001 From: cpojer Date: Mon, 2 Feb 2026 15:37:05 +0900 Subject: [PATCH] chore: Enable `no-unnecessary-template-expression` lint rule. --- .oxlintrc.json | 1 - extensions/twitch/src/twitch-client.ts | 12 ++++++------ src/agents/bash-tools.exec.ts | 12 ++++-------- src/cli/directory-cli.ts | 2 +- src/commands/status-all/diagnosis.ts | 8 ++++---- src/cron/isolated-agent/run.ts | 3 +-- src/daemon/launchd.ts | 2 +- src/daemon/schtasks.ts | 2 +- src/daemon/systemd.ts | 2 +- src/telegram/bot/helpers.ts | 2 +- 10 files changed, 20 insertions(+), 26 deletions(-) diff --git a/.oxlintrc.json b/.oxlintrc.json index 339cfc8b6..97e863949 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -15,7 +15,6 @@ "oxc/no-async-endpoint-handlers": "off", "oxc/no-map-spread": "off", "typescript/no-extraneous-class": "off", - "typescript/no-unnecessary-template-expression": "off", "typescript/no-unsafe-type-assertion": "off", "unicorn/consistent-function-scoping": "off", "unicorn/require-post-message-target-origin": "off" diff --git a/extensions/twitch/src/twitch-client.ts b/extensions/twitch/src/twitch-client.ts index b19345dcd..538925c15 100644 --- a/extensions/twitch/src/twitch-client.ts +++ b/extensions/twitch/src/twitch-client.ts @@ -119,22 +119,22 @@ export class TwitchClientManager { log: (level, message) => { switch (level) { case LogLevel.CRITICAL: - this.logger.error(`${message}`); + this.logger.error(message); break; case LogLevel.ERROR: - this.logger.error(`${message}`); + this.logger.error(message); break; case LogLevel.WARNING: - this.logger.warn(`${message}`); + this.logger.warn(message); break; case LogLevel.INFO: - this.logger.info(`${message}`); + this.logger.info(message); break; case LogLevel.DEBUG: - this.logger.debug?.(`${message}`); + this.logger.debug?.(message); break; case LogLevel.TRACE: - this.logger.debug?.(`${message}`); + this.logger.debug?.(message); break; } }, diff --git a/src/agents/bash-tools.exec.ts b/src/agents/bash-tools.exec.ts index e49b5d579..2d4b0040b 100644 --- a/src/agents/bash-tools.exec.ts +++ b/src/agents/bash-tools.exec.ts @@ -1458,8 +1458,7 @@ export function createExecTool( { type: "text", text: - `${warningText}` + - `Approval required (id ${approvalSlug}). ` + + `${warningText}Approval required (id ${approvalSlug}). ` + "Approve to run; updates will arrive after completion.", }, ], @@ -1541,12 +1540,9 @@ export function createExecTool( content: [ { type: "text", - text: - `${getWarningText()}` + - `Command still running (session ${run.session.id}, pid ${ - run.session.pid ?? "n/a" - }). ` + - "Use process (list/poll/log/write/kill/clear/remove) for follow-up.", + text: `${getWarningText()}Command still running (session ${run.session.id}, pid ${ + run.session.pid ?? "n/a" + }). Use process (list/poll/log/write/kill/clear/remove) for follow-up.`, }, ], details: { diff --git a/src/cli/directory-cli.ts b/src/cli/directory-cli.ts index 54ef51b01..23b4d4b3f 100644 --- a/src/cli/directory-cli.ts +++ b/src/cli/directory-cli.ts @@ -95,7 +95,7 @@ export function registerDirectoryCli(program: Command) { return; } const tableWidth = Math.max(60, (process.stdout.columns ?? 120) - 1); - defaultRuntime.log(`${theme.heading("Self")}`); + defaultRuntime.log(theme.heading("Self")); defaultRuntime.log( renderTable({ width: tableWidth, diff --git a/src/commands/status-all/diagnosis.ts b/src/commands/status-all/diagnosis.ts index 6c34336ff..7a4447f7d 100644 --- a/src/commands/status-all/diagnosis.ts +++ b/src/commands/status-all/diagnosis.ts @@ -71,7 +71,7 @@ export async function appendStatusAllDiagnosis(params: { }; lines.push(""); - lines.push(`${muted("Gateway connection details:")}`); + lines.push(muted("Gateway connection details:")); for (const line of redactSecrets(params.connectionDetailsForReport) .split("\n") .map((l) => l.trimEnd())) { @@ -116,7 +116,7 @@ export async function appendStatusAllDiagnosis(params: { const isTrivialLastErr = lastErrClean.length < 8 || lastErrClean === "}" || lastErrClean === "{"; if (lastErrClean && !isTrivialLastErr) { lines.push(""); - lines.push(`${muted("Gateway last log line:")}`); + lines.push(muted("Gateway last log line:")); lines.push(` ${muted(redactSecrets(lastErrClean))}`); } @@ -179,7 +179,7 @@ export async function appendStatusAllDiagnosis(params: { ]); if (stderrTail.length > 0 || stdoutTail.length > 0) { lines.push(""); - lines.push(`${muted(`Gateway logs (tail, summarized): ${logPaths.logDir}`)}`); + lines.push(muted(`Gateway logs (tail, summarized): ${logPaths.logDir}`)); lines.push(` ${muted(`# stderr: ${logPaths.stderrPath}`)}`); for (const line of summarizeLogTail(stderrTail, { maxLines: 22 }).map(redactSecrets)) { lines.push(` ${muted(line)}`); @@ -236,7 +236,7 @@ export async function appendStatusAllDiagnosis(params: { })(); if (healthErr) { lines.push(""); - lines.push(`${muted("Gateway health:")}`); + lines.push(muted("Gateway health:")); lines.push(` ${muted(redactSecrets(healthErr))}`); } diff --git a/src/cron/isolated-agent/run.ts b/src/cron/isolated-agent/run.ts index c0d6ae3cd..e3f6bc91d 100644 --- a/src/cron/isolated-agent/run.ts +++ b/src/cron/isolated-agent/run.ts @@ -265,8 +265,7 @@ export async function runCronIsolatedAgentTurn(params: { if (suspiciousPatterns.length > 0) { logWarn( `[security] Suspicious patterns detected in external hook content ` + - `(session=${baseSessionKey}, patterns=${suspiciousPatterns.length}): ` + - `${suspiciousPatterns.slice(0, 3).join(", ")}`, + `(session=${baseSessionKey}, patterns=${suspiciousPatterns.length}): ${suspiciousPatterns.slice(0, 3).join(", ")}`, ); } } diff --git a/src/daemon/launchd.ts b/src/daemon/launchd.ts index 273d2e31a..a40b7a7e4 100644 --- a/src/daemon/launchd.ts +++ b/src/daemon/launchd.ts @@ -355,7 +355,7 @@ export async function uninstallLaunchAgent({ } function isLaunchctlNotLoaded(res: { stdout: string; stderr: string; code: number }): boolean { - const detail = `${res.stderr || res.stdout}`.toLowerCase(); + const detail = (res.stderr || res.stdout).toLowerCase(); return ( detail.includes("no such process") || detail.includes("could not find service") || diff --git a/src/daemon/schtasks.ts b/src/daemon/schtasks.ts index 3d8585596..64729b895 100644 --- a/src/daemon/schtasks.ts +++ b/src/daemon/schtasks.ts @@ -327,7 +327,7 @@ export async function uninstallScheduledTask({ } function isTaskNotRunning(res: { stdout: string; stderr: string; code: number }): boolean { - const detail = `${res.stderr || res.stdout}`.toLowerCase(); + const detail = (res.stderr || res.stdout).toLowerCase(); return detail.includes("not running"); } diff --git a/src/daemon/systemd.ts b/src/daemon/systemd.ts index 7b314dd38..1a5dd72b9 100644 --- a/src/daemon/systemd.ts +++ b/src/daemon/systemd.ts @@ -387,7 +387,7 @@ async function isSystemctlAvailable(): Promise { if (res.code === 0) { return true; } - const detail = `${res.stderr || res.stdout}`.toLowerCase(); + const detail = (res.stderr || res.stdout).toLowerCase(); return !detail.includes("not found"); } diff --git a/src/telegram/bot/helpers.ts b/src/telegram/bot/helpers.ts index 784551ef0..5f91e7ab2 100644 --- a/src/telegram/bot/helpers.ts +++ b/src/telegram/bot/helpers.ts @@ -255,7 +255,7 @@ export function describeReplyTarget(msg: TelegramMessage): TelegramReplyTarget | return null; } const sender = reply ? buildSenderName(reply) : undefined; - const senderLabel = sender ? `${sender}` : "unknown sender"; + const senderLabel = sender ?? "unknown sender"; return { id: reply?.message_id ? String(reply.message_id) : undefined,