Enable more biome lints and fix things

This commit is contained in:
Mario Zechner 2025-12-21 22:56:20 +01:00
parent 9c18439c4d
commit d5fd685901
57 changed files with 151 additions and 199 deletions

View file

@ -95,13 +95,13 @@ export class ArminComponent implements Component {
// Clip row to available width before applying color
const clipped = row.slice(0, availableWidth).join("");
const padRight = Math.max(0, width - padding - clipped.length);
return " " + theme.fg("accent", clipped) + " ".repeat(padRight);
return ` ${theme.fg("accent", clipped)}${" ".repeat(padRight)}`;
});
// Add "ARMIN SAYS HI" at the end
const message = "ARMIN SAYS HI";
const msgPadRight = Math.max(0, width - padding - message.length);
this.cachedLines.push(" " + theme.fg("accent", message) + " ".repeat(msgPadRight));
this.cachedLines.push(` ${theme.fg("accent", message)}${" ".repeat(msgPadRight)}`);
this.cachedWidth = width;
this.cachedVersion = this.gridVersion;

View file

@ -132,11 +132,11 @@ export class BashExecutionComponent extends Container {
if (this.expanded) {
// Show all lines
const displayText = availableLines.map((line) => theme.fg("muted", line)).join("\n");
this.contentContainer.addChild(new Text("\n" + displayText, 1, 0));
this.contentContainer.addChild(new Text(`\n${displayText}`, 1, 0));
} else {
// Render preview lines, then cap at PREVIEW_LINES visual lines
const tempText = new Text(
"\n" + previewLogicalLines.map((line) => theme.fg("muted", line)).join("\n"),
`\n${previewLogicalLines.map((line) => theme.fg("muted", line)).join("\n")}`,
1,
0,
);
@ -170,7 +170,7 @@ export class BashExecutionComponent extends Container {
}
if (statusParts.length > 0) {
this.contentContainer.addChild(new Text("\n" + statusParts.join("\n"), 1, 0));
this.contentContainer.addChild(new Text(`\n${statusParts.join("\n")}`, 1, 0));
}
}
}

View file

@ -168,17 +168,17 @@ export class FooterComponent implements Component {
// Format token counts (similar to web-ui)
const formatTokens = (count: number): string => {
if (count < 1000) return count.toString();
if (count < 10000) return (count / 1000).toFixed(1) + "k";
if (count < 1000000) return Math.round(count / 1000) + "k";
if (count < 10000000) return (count / 1000000).toFixed(1) + "M";
return Math.round(count / 1000000) + "M";
if (count < 10000) return `${(count / 1000).toFixed(1)}k`;
if (count < 1000000) return `${Math.round(count / 1000)}k`;
if (count < 10000000) return `${(count / 1000000).toFixed(1)}M`;
return `${Math.round(count / 1000000)}M`;
};
// Replace home directory with ~
let pwd = process.cwd();
const home = process.env.HOME || process.env.USERPROFILE;
if (home && pwd.startsWith(home)) {
pwd = "~" + pwd.slice(home.length);
pwd = `~${pwd.slice(home.length)}`;
}
// Add git branch if available
@ -247,7 +247,7 @@ export class FooterComponent implements Component {
if (statsLeftWidth > width) {
// Truncate statsLeft to fit width (no room for right side)
const plainStatsLeft = statsLeft.replace(/\x1b\[[0-9;]*m/g, "");
statsLeft = plainStatsLeft.substring(0, width - 3) + "...";
statsLeft = `${plainStatsLeft.substring(0, width - 3)}...`;
statsLeftWidth = visibleWidth(statsLeft);
}

View file

@ -58,7 +58,7 @@ export class HookSelectorComponent extends Container {
if (isSelected) {
text = theme.fg("accent", "→ ") + theme.fg("accent", option);
} else {
text = " " + theme.fg("text", option);
text = ` ${theme.fg("text", option)}`;
}
this.listContainer.addChild(new Text(text, 1, 0));

View file

@ -175,12 +175,12 @@ export class ModelSelectorComponent extends Container {
const modelText = `${item.id}`;
const providerBadge = theme.fg("muted", `[${item.provider}]`);
const checkmark = isCurrent ? theme.fg("success", " ✓") : "";
line = prefix + theme.fg("accent", modelText) + " " + providerBadge + checkmark;
line = `${prefix + theme.fg("accent", modelText)} ${providerBadge}${checkmark}`;
} else {
const modelText = ` ${item.id}`;
const providerBadge = theme.fg("muted", `[${item.provider}]`);
const checkmark = isCurrent ? theme.fg("success", " ✓") : "";
line = modelText + " " + providerBadge + checkmark;
line = `${modelText} ${providerBadge}${checkmark}`;
}
this.listContainer.addChild(new Text(line, 0, 0));

View file

@ -21,7 +21,7 @@ import { renderDiff } from "./diff.js";
function shortenPath(path: string): string {
const home = os.homedir();
if (path.startsWith(home)) {
return "~" + path.slice(home.length);
return `~${path.slice(home.length)}`;
}
return path;
}
@ -269,7 +269,7 @@ export class ToolExecutionComponent extends Container {
);
}
}
text += "\n" + theme.fg("warning", `[${warnings.join(". ")}]`);
text += `\n${theme.fg("warning", `[${warnings.join(". ")}]`)}`;
}
}
} else if (this.toolName === "read") {
@ -284,7 +284,7 @@ export class ToolExecutionComponent extends Container {
pathDisplay += theme.fg("warning", `:${startLine}${endLine ? `-${endLine}` : ""}`);
}
text = theme.fg("toolTitle", theme.bold("read")) + " " + pathDisplay;
text = `${theme.fg("toolTitle", theme.bold("read"))} ${pathDisplay}`;
if (this.result) {
const output = this.getTextOutput();
@ -377,17 +377,17 @@ export class ToolExecutionComponent extends Container {
if (this.result.isError) {
const errorText = this.getTextOutput();
if (errorText) {
text += "\n\n" + theme.fg("error", errorText);
text += `\n\n${theme.fg("error", errorText)}`;
}
} else if (this.result.details?.diff) {
text += "\n\n" + renderDiff(this.result.details.diff, { filePath: rawPath });
text += `\n\n${renderDiff(this.result.details.diff, { filePath: rawPath })}`;
}
}
} else if (this.toolName === "ls") {
const path = shortenPath(this.args?.path || ".");
const limit = this.args?.limit;
text = theme.fg("toolTitle", theme.bold("ls")) + " " + theme.fg("accent", path);
text = `${theme.fg("toolTitle", theme.bold("ls"))} ${theme.fg("accent", path)}`;
if (limit !== undefined) {
text += theme.fg("toolOutput", ` (limit ${limit})`);
}
@ -400,7 +400,7 @@ export class ToolExecutionComponent extends Container {
const displayLines = lines.slice(0, maxLines);
const remaining = lines.length - maxLines;
text += "\n\n" + displayLines.map((line: string) => theme.fg("toolOutput", line)).join("\n");
text += `\n\n${displayLines.map((line: string) => theme.fg("toolOutput", line)).join("\n")}`;
if (remaining > 0) {
text += theme.fg("toolOutput", `\n... (${remaining} more lines)`);
}
@ -416,7 +416,7 @@ export class ToolExecutionComponent extends Container {
if (truncation?.truncated) {
warnings.push(`${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit`);
}
text += "\n" + theme.fg("warning", `[Truncated: ${warnings.join(", ")}]`);
text += `\n${theme.fg("warning", `[Truncated: ${warnings.join(", ")}]`)}`;
}
}
} else if (this.toolName === "find") {
@ -441,7 +441,7 @@ export class ToolExecutionComponent extends Container {
const displayLines = lines.slice(0, maxLines);
const remaining = lines.length - maxLines;
text += "\n\n" + displayLines.map((line: string) => theme.fg("toolOutput", line)).join("\n");
text += `\n\n${displayLines.map((line: string) => theme.fg("toolOutput", line)).join("\n")}`;
if (remaining > 0) {
text += theme.fg("toolOutput", `\n... (${remaining} more lines)`);
}
@ -457,7 +457,7 @@ export class ToolExecutionComponent extends Container {
if (truncation?.truncated) {
warnings.push(`${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit`);
}
text += "\n" + theme.fg("warning", `[Truncated: ${warnings.join(", ")}]`);
text += `\n${theme.fg("warning", `[Truncated: ${warnings.join(", ")}]`)}`;
}
}
} else if (this.toolName === "grep") {
@ -486,7 +486,7 @@ export class ToolExecutionComponent extends Container {
const displayLines = lines.slice(0, maxLines);
const remaining = lines.length - maxLines;
text += "\n\n" + displayLines.map((line: string) => theme.fg("toolOutput", line)).join("\n");
text += `\n\n${displayLines.map((line: string) => theme.fg("toolOutput", line)).join("\n")}`;
if (remaining > 0) {
text += theme.fg("toolOutput", `\n... (${remaining} more lines)`);
}
@ -506,7 +506,7 @@ export class ToolExecutionComponent extends Container {
if (linesTruncated) {
warnings.push("some lines truncated");
}
text += "\n" + theme.fg("warning", `[Truncated: ${warnings.join(", ")}]`);
text += `\n${theme.fg("warning", `[Truncated: ${warnings.join(", ")}]`)}`;
}
}
} else {
@ -514,10 +514,10 @@ export class ToolExecutionComponent extends Container {
text = theme.fg("toolTitle", theme.bold(this.toolName));
const content = JSON.stringify(this.args, null, 2);
text += "\n\n" + content;
text += `\n\n${content}`;
const output = this.getTextOutput();
if (output) {
text += "\n" + output;
text += `\n${output}`;
}
}

View file

@ -239,7 +239,7 @@ export class InteractiveMode {
"\n" +
theme.fg("dim", "drop files") +
theme.fg("muted", " to attach");
const header = new Text(logo + "\n" + instructions, 1, 0);
const header = new Text(`${logo}\n${instructions}`, 1, 0);
// Setup UI layout
this.ui.addChild(new Spacer(1));
@ -1340,7 +1340,7 @@ export class InteractiveMode {
if (queuedMessages.length > 0) {
this.pendingMessagesContainer.addChild(new Spacer(1));
for (const message of queuedMessages) {
const queuedText = theme.fg("dim", "Queued: " + message);
const queuedText = theme.fg("dim", `Queued: ${message}`);
this.pendingMessagesContainer.addChild(new TruncatedText(queuedText, 1, 0));
}
}
@ -1808,7 +1808,7 @@ export class InteractiveMode {
this.chatContainer.addChild(new Spacer(1));
this.chatContainer.addChild(
new Text(theme.fg("accent", "✓ Context cleared") + "\n" + theme.fg("muted", "Started fresh session"), 1, 1),
new Text(`${theme.fg("accent", "✓ Context cleared")}\n${theme.fg("muted", "Started fresh session")}`, 1, 1),
);
this.ui.requestRender();
}
@ -1840,7 +1840,7 @@ export class InteractiveMode {
this.chatContainer.addChild(new Spacer(1));
this.chatContainer.addChild(
new Text(theme.fg("accent", "✓ Debug log written") + "\n" + theme.fg("muted", debugLogPath), 1, 1),
new Text(`${theme.fg("accent", "✓ Debug log written")}\n${theme.fg("muted", debugLogPath)}`, 1, 1),
);
this.ui.requestRender();
}

View file

@ -534,7 +534,7 @@ export function initTheme(themeName?: string, enableWatcher: boolean = false): v
if (enableWatcher) {
startThemeWatcher();
}
} catch (error) {
} catch (_error) {
// Theme is invalid - fall back to dark theme silently
currentThemeName = "dark";
theme = loadTheme("dark");
@ -598,7 +598,7 @@ function startThemeWatcher(): void {
if (onThemeChangeCallback) {
onThemeChangeCallback();
}
} catch (error) {
} catch (_error) {
// Ignore errors (file might be in invalid state while being edited)
}
}, 100);
@ -619,7 +619,7 @@ function startThemeWatcher(): void {
}, 100);
}
});
} catch (error) {
} catch (_error) {
// Ignore errors starting watcher
}
}

View file

@ -456,7 +456,7 @@ export class RpcClient {
},
});
this.process!.stdin!.write(JSON.stringify(fullCommand) + "\n");
this.process!.stdin!.write(`${JSON.stringify(fullCommand)}\n`);
});
}