Skip to content

Commit 4345b2d

Browse files
committed
chore: biome formatter pass + stable React keys in PixelC
Required for prepublishOnly to clear lint. PixelC's row keys now use named ids (top/mid-1/mid-2/mid-3/bot) instead of the array index, since the three repeating FILL rows aren't distinguishable by content.
1 parent bcfae6d commit 4345b2d

4 files changed

Lines changed: 18 additions & 17 deletions

File tree

biome.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@
2424
"lineWidth": 120
2525
},
2626
"files": {
27-
"includes": [
28-
"src/**/*.ts",
29-
"src/**/*.tsx",
30-
"!**/node_modules/**/*",
31-
"!**/dist/**/*"
32-
]
27+
"includes": ["src/**/*.ts", "src/**/*.tsx", "!**/node_modules/**/*", "!**/dist/**/*"]
3328
}
3429
}

src/ui/Input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Box, Text, useInput } from "ink";
22
import { useMemo, useRef, useState } from "react";
3+
import { logInputEvent } from "./debug-input.js";
34
import {
45
backspace,
56
deleteForward,
@@ -15,7 +16,6 @@ import {
1516
undo,
1617
yank,
1718
} from "./input-state.js";
18-
import { logInputEvent } from "./debug-input.js";
1919
import { completePath, findAtTokenAt } from "./path-complete.js";
2020

2121
export interface SlashCommandSuggestion {

src/ui/PixelC.tsx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,24 @@ interface PixelCProps {
1414
color?: string;
1515
}
1616

17-
const ROWS: readonly string[] = [
18-
`${GAP}${FILL}${FILL}${FILL}`,
19-
FILL,
20-
FILL,
21-
FILL,
22-
`${GAP}${FILL}${FILL}${FILL}`,
17+
// Row id doubles as the React key. Names describe the C shape so the
18+
// keys are stable regardless of order (biome's array-index-as-key rule
19+
// is right in general — but here the rows aren't unique by content
20+
// (the three FILL rows repeat), so we lean on positional ids).
21+
const ROWS: readonly { id: string; text: string }[] = [
22+
{ id: "top", text: `${GAP}${FILL}${FILL}${FILL}` },
23+
{ id: "mid-1", text: FILL },
24+
{ id: "mid-2", text: FILL },
25+
{ id: "mid-3", text: FILL },
26+
{ id: "bot", text: `${GAP}${FILL}${FILL}${FILL}` },
2327
];
2428

2529
export function PixelC({ color = "cyan" }: PixelCProps) {
2630
return (
2731
<Box flexDirection="column">
28-
{ROWS.map((text, i) => (
29-
<Text key={`pixc-${i}`} bold color={color}>
30-
{text}
32+
{ROWS.map((row) => (
33+
<Text key={row.id} bold color={color}>
34+
{row.text}
3135
</Text>
3236
))}
3337
</Box>

src/ui/terminal-restore.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ export function installTerminalRestoreHandlers(instance?: Instance): void {
7171
});
7272
process.on("uncaughtException", (err) => {
7373
restore();
74-
process.stderr.write(`\nuncaught exception: ${err instanceof Error ? err.stack ?? err.message : String(err)}\n`);
74+
process.stderr.write(
75+
`\nuncaught exception: ${err instanceof Error ? (err.stack ?? err.message) : String(err)}\n`,
76+
);
7577
process.exit(1);
7678
});
7779
process.on("unhandledRejection", (reason) => {

0 commit comments

Comments
 (0)