fix: resolve CI failures — errcheck lint and TS noUncheckedIndexedAccess errors

- ws_integration_test.go:42: wrap resp.Body.Close() to handle errcheck
- dispatcher.ts:183: add non-null assertion on sorted[0] array access
- keybinds-tab.test.ts: add non-null assertions on NodeList index accesses
- logs-tab.test.ts: add non-null assertions on querySelectorAll index accesses

Co-authored-by: J3vb <J3vb@users.noreply.github.com>
This commit is contained in:
claude[bot]
2026-03-17 14:01:26 +00:00
co-authored by J3vb
parent 45b720811e
commit 404764ce97
4 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -180,7 +180,7 @@ export function wireDispatcher(ws: WsClient): DispatcherCleanup {
const sorted = [...remaining.values()]
.filter((ch) => ch.type === "text")
.sort((a, b) => a.position - b.position);
const firstTextId = sorted.length > 0 ? sorted[0].id : null;
const firstTextId = sorted.length > 0 ? sorted[0]!.id : null;
setActiveChannel(firstTextId);
log.info("Active channel deleted, redirected", { deletedId: payload.id });
}
@@ -19,21 +19,21 @@ describe("KeybindsTab", () => {
const el = buildKeybindsTab();
const rows = el.querySelectorAll(".keybind-row");
expect(rows.length).toBe(2);
const pttLabel = rows[0].querySelector(".setting-label");
const pttLabel = rows[0]!.querySelector(".setting-label");
expect(pttLabel!.textContent).toBe("Push to Talk");
});
it("renders Quick Switcher keybind row with Ctrl + K", () => {
const el = buildKeybindsTab();
const rows = el.querySelectorAll(".keybind-row");
const kbd = rows[1].querySelector(".kbd");
const kbd = rows[1]!.querySelector(".kbd");
expect(kbd!.textContent).toBe("Ctrl + K");
});
it("shows fallback for PTT when not configured", () => {
const el = buildKeybindsTab();
const rows = el.querySelectorAll(".keybind-row");
const kbd = rows[0].querySelector(".kbd");
const kbd = rows[0]!.querySelector(".kbd");
expect(kbd!.textContent).toBe("Not set");
});
});
@@ -146,7 +146,7 @@ describe("LogsTab", () => {
]);
const handle = createLogsTab(() => "Logs" as TabName, controller.signal);
const el = handle.build();
const filterSelect = el.querySelectorAll("select")[0];
const filterSelect = el.querySelectorAll("select")[0]!;
// Change to "warn" filter
filterSelect.value = "warn";
@@ -169,7 +169,7 @@ describe("LogsTab", () => {
it("level selector calls setLogLevel", () => {
const handle = createLogsTab(() => "Logs" as TabName, controller.signal);
const el = handle.build();
const levelSelect = el.querySelectorAll("select")[1];
const levelSelect = el.querySelectorAll("select")[1]!;
levelSelect.value = "error";
levelSelect.dispatchEvent(new Event("change"));
expect(mockSetLogLevel).toHaveBeenCalledWith("error");
+1 -1
View File
@@ -39,7 +39,7 @@ func TestServeWS_InvalidUpgrade_ReturnsError(t *testing.T) {
if err != nil {
t.Fatalf("http.Get: %v", err)
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()
// nhooyr.io/websocket returns 400 or 426 when upgrade is absent.
if resp.StatusCode == 200 {