From 012e02d1bbd85ea9309b9af78a5ea843708c0c9d Mon Sep 17 00:00:00 2001 From: Will Gordon Date: Tue, 27 Oct 2026 21:50:00 -0400 Subject: [PATCH 1/7] chore(lint): adds type-aware oxlint config --- .oxlintrc.json | 43 ++++++ README.md | 1 + mcp/tests/data-source.test.ts | 46 +++--- mcp/tests/integration.test.ts | 13 +- mcp/tests/tools.test.ts | 3 - package.json | 6 +- pnpm-lock.yaml | 282 ++++++++++++++++++++++++++++++++++ renovate.json | 6 + tsconfig.lint.json | 16 ++ 9 files changed, 382 insertions(+), 34 deletions(-) create mode 100644 .oxlintrc.json create mode 100644 tsconfig.lint.json diff --git a/.oxlintrc.json b/.oxlintrc.json new file mode 100644 index 00000000..9db11102 --- /dev/null +++ b/.oxlintrc.json @@ -0,0 +1,43 @@ +{ + "$schema": "./node_modules/oxlint/configuration_schema.json", + "plugins": ["typescript", "unicorn", "import", "promise", "vitest"], + "categories": { + "correctness": "error", + "suspicious": "warn", + "perf": "warn" + }, + "ignorePatterns": [ + "dist/**", + "mcp/dist/**", + "**/node_modules/**", + ".wrangler/**", + "hack/**", + "playwright-report/**", + "test-results/**" + ], + "rules": { + "typescript/no-unsafe-type-assertion": "off", + "eslint/no-underscore-dangle": "off", + "unicorn/consistent-function-scoping": "off", + "eslint/no-unassigned-vars": "off", + "eslint/no-await-in-loop": "off", + "unicorn/prefer-add-event-listener": "off", + "import/no-unassigned-import": "off", + "promise/always-return": "off" + }, + "overrides": [ + { + "files": ["tests/**", "e2e/**", "mcp/tests/**"], + "rules": { + "vitest/require-mock-type-parameters": "off", + "vitest/expect-expect": "off", + "typescript/unbound-method": "off", + "vitest/no-standalone-expect": "off", + "vitest/no-conditional-expect": "off", + "vitest/require-to-throw-message": "off", + "typescript/no-misused-spread": "off", + "vitest/valid-expect": "off" + } + } + ] +} diff --git a/README.md b/README.md index 365395e0..67db53bc 100644 --- a/README.md +++ b/README.md @@ -164,6 +164,7 @@ pnpm run dev # Start Vite dev server pnpm test # Run unit/component tests pnpm test:e2e # Run Playwright E2E tests pnpm run typecheck # TypeScript check +pnpm lint # Run type-aware linter (oxlint) pnpm run build # Production build pnpm run screenshot # Capture dashboard screenshot ``` diff --git a/mcp/tests/data-source.test.ts b/mcp/tests/data-source.test.ts index 8b1729cf..d78edbfd 100644 --- a/mcp/tests/data-source.test.ts +++ b/mcp/tests/data-source.test.ts @@ -15,7 +15,7 @@ import type { DataSource } from "../src/data-source.js"; // ── Mock ws-relay module ─────────────────────────────────────────────────────── // isRelayConnected is used by CompositeDataSource.tryBoth() let _mockIsConnected = false; -let _mockSendRequest: ReturnType; +let _mockSendRequest: ReturnType Promise>>; vi.mock("../src/ws-relay.js", () => ({ get isRelayConnected() { @@ -145,7 +145,7 @@ describe("OctokitDataSource", () => { pull_request: { merged_at: null }, }; - const responses = new Map([ + const responses = new Map([ ["GET /user", makeUserResponse()], ["GET /search/issues", makeSearchResponse([searchItem])], ]); @@ -177,7 +177,7 @@ describe("OctokitDataSource", () => { // no pull_request field }; - const responses = new Map([ + const responses = new Map([ ["GET /user", makeUserResponse()], ["GET /search/issues", makeSearchResponse([issueItem])], ]); @@ -192,7 +192,7 @@ describe("OctokitDataSource", () => { // Clear cached config to verify explicit param works without it setCachedConfig({ selectedRepos: [], trackedUsers: [], upstreamRepos: [], monitoredRepos: [], enableActions: true }); - const responses = new Map([ + const responses = new Map([ ["GET /user", makeUserResponse()], ["GET /search/issues", makeSearchResponse([])], ]); @@ -253,7 +253,7 @@ describe("OctokitDataSource", () => { }; const readyPR = { ...draftPR, id: 2, number: 2, draft: false, title: "Ready" }; - const responses = new Map([ + const responses = new Map([ ["GET /user", makeUserResponse()], ["GET /search/issues", makeSearchResponse([draftPR, readyPR])], ]); @@ -267,7 +267,7 @@ describe("OctokitDataSource", () => { it("filters by status=approved", async () => { // Note: REST search doesn't return reviewDecision, so approved filter returns empty - const responses = new Map([ + const responses = new Map([ ["GET /user", makeUserResponse()], ["GET /search/issues", makeSearchResponse([{ id: 1, number: 1, title: "Approved", state: "open", draft: false, @@ -302,7 +302,7 @@ describe("OctokitDataSource", () => { pull_request: { merged_at: null }, }; - const responses = new Map([ + const responses = new Map([ ["GET /user", makeUserResponse()], ["GET /search/issues", makeSearchResponse([prItem])], ]); @@ -341,7 +341,7 @@ describe("OctokitDataSource", () => { pull_request: { merged_at: null }, }; - const responses = new Map([ + const responses = new Map([ ["GET /user", makeUserResponse()], ["GET /search/issues", makeSearchResponse([prItem])], ]); @@ -377,7 +377,7 @@ describe("OctokitDataSource", () => { pull_request: { merged_at: null }, }; - const responses = new Map([ + const responses = new Map([ ["GET /user", makeUserResponse()], ["GET /search/issues", makeSearchResponse([issueItem, prItem])], ]); @@ -392,7 +392,7 @@ describe("OctokitDataSource", () => { }); it("passes explicit repo to search query", async () => { - const responses = new Map([ + const responses = new Map([ ["GET /user", makeUserResponse()], ["GET /search/issues", makeSearchResponse([])], ]); @@ -541,7 +541,7 @@ describe("OctokitDataSource", () => { }); it("constructs involves_me query with user login", async () => { - const requestMock = vi.fn().mockImplementation(async (route: string) => { + const requestMock = vi.fn(async (route: string, _params?: Record) => { if (route === "GET /user") return { data: { login: "testuser" }, headers: {} }; if (route === "GET /search/issues") return { data: { items: [], total_count: 0 }, headers: {} }; if (route === "GET /repos/{owner}/{repo}/actions/runs") return { data: { workflow_runs: [], total_count: 0 }, headers: {} }; @@ -552,17 +552,17 @@ describe("OctokitDataSource", () => { await ds.getDashboardSummary("involves_me"); const searchCalls = requestMock.mock.calls.filter( - ([route]: [string]) => route === "GET /search/issues" + ([route]) => route === "GET /search/issues" ); - const prCall = searchCalls.find(([, params]: [string, Record]) => - typeof params?.q === "string" && (params.q as string).includes("is:pr") + const prCall = searchCalls.find(([, params]) => + typeof params?.q === "string" && (params.q).includes("is:pr") ); expect(prCall).toBeDefined(); - expect(prCall![1].q).toContain("involves:testuser"); + expect(prCall![1]?.q).toContain("involves:testuser"); }); it("constructs all-scope query without involves filter", async () => { - const requestMock = vi.fn().mockImplementation(async (route: string) => { + const requestMock = vi.fn(async (route: string, _params?: Record) => { if (route === "GET /user") return { data: { login: "testuser" }, headers: {} }; if (route === "GET /search/issues") return { data: { items: [], total_count: 0 }, headers: {} }; if (route === "GET /repos/{owner}/{repo}/actions/runs") return { data: { workflow_runs: [], total_count: 0 }, headers: {} }; @@ -573,14 +573,14 @@ describe("OctokitDataSource", () => { await ds.getDashboardSummary("all"); const searchCalls = requestMock.mock.calls.filter( - ([route]: [string]) => route === "GET /search/issues" + ([route]) => route === "GET /search/issues" ); - const prCall = searchCalls.find(([, params]: [string, Record]) => - typeof params?.q === "string" && (params.q as string).includes("is:pr") && - !(params.q as string).includes("review-requested") + const prCall = searchCalls.find(([, params]) => + typeof params?.q === "string" && (params.q).includes("is:pr") && + !(params.q).includes("review-requested") ); expect(prCall).toBeDefined(); - expect(prCall![1].q).not.toContain("involves:"); + expect(prCall![1]?.q).not.toContain("involves:"); }); it("returns failingRunCount=null and skips actions API when enableActions is false", async () => { @@ -591,7 +591,7 @@ describe("OctokitDataSource", () => { monitoredRepos: [], enableActions: false, }); - const requestMock = vi.fn().mockImplementation(async (route: string) => { + const requestMock = vi.fn(async (route: string, _params?: Record) => { if (route === "GET /user") return { data: { login: "testuser" }, headers: {} }; if (route === "GET /search/issues") return { data: { items: [], total_count: 0 }, headers: {} }; throw new Error(`Unexpected: ${route}`); @@ -602,7 +602,7 @@ describe("OctokitDataSource", () => { expect(summary.failingRunCount).toBeNull(); const actionsCalls = requestMock.mock.calls.filter( - ([route]: [string]) => route === "GET /repos/{owner}/{repo}/actions/runs" + ([route]) => route === "GET /repos/{owner}/{repo}/actions/runs" ); expect(actionsCalls).toHaveLength(0); }); diff --git a/mcp/tests/integration.test.ts b/mcp/tests/integration.test.ts index e268962c..67a63a25 100644 --- a/mcp/tests/integration.test.ts +++ b/mcp/tests/integration.test.ts @@ -14,12 +14,11 @@ import { import { WebSocketDataSource, CompositeDataSource, - OctokitDataSource, setCachedConfig, } from "../src/data-source.js"; import type { DataSource } from "../src/data-source.js"; import { METHODS, NOTIFICATIONS } from "../../src/shared/protocol.js"; -import { makeIssue, makePullRequest, makeWorkflowRun } from "../../tests/helpers/factories.js"; +import { makeIssue, makePullRequest } from "../../tests/helpers/factories.js"; // ── Helpers ──────────────────────────────────────────────────────────────────── @@ -69,7 +68,7 @@ function waitForClose(ws: WebSocket, timeout = 3000): Promise { function waitForMessage(ws: WebSocket, timeout = 3000): Promise { return new Promise((resolve, reject) => { const t = setTimeout(() => reject(new Error("Timeout waiting for message")), timeout); - ws.once("message", (data) => { clearTimeout(t); resolve(data.toString()); }); + ws.once("message", (data) => { clearTimeout(t); resolve((data as Buffer).toString()); }); }); } @@ -126,7 +125,7 @@ describe("Integration: WebSocket relay data flow", () => { // Client acts as SPA — responds to JSON-RPC requests client.on("message", (data) => { - const req = JSON.parse(data.toString()); + const req = JSON.parse((data as Buffer).toString()); if (req.method === METHODS.GET_RATE_LIMIT) { client!.send(JSON.stringify({ jsonrpc: "2.0", @@ -231,7 +230,7 @@ describe("Integration: WebSocketDataSource through relay", () => { const mockPRs = [makePullRequest({ title: "Fix auth bug", repoFullName: "acme/app" })]; client.on("message", (data) => { - const req = JSON.parse(data.toString()); + const req = JSON.parse((data as Buffer).toString()); if (req.method === METHODS.GET_OPEN_PRS) { client!.send(JSON.stringify({ jsonrpc: "2.0", @@ -254,7 +253,7 @@ describe("Integration: WebSocketDataSource through relay", () => { await waitForOpen(client); client.on("message", (data) => { - const req = JSON.parse(data.toString()); + const req = JSON.parse((data as Buffer).toString()); if (req.method === METHODS.GET_CONFIG) { client!.send(JSON.stringify({ jsonrpc: "2.0", @@ -322,7 +321,7 @@ describe("Integration: CompositeDataSource fallback", () => { await waitForOpen(client); client.on("message", (data) => { - const req = JSON.parse(data.toString()); + const req = JSON.parse((data as Buffer).toString()); if (req.method === METHODS.GET_OPEN_ISSUES) { client.send(JSON.stringify({ jsonrpc: "2.0", diff --git a/mcp/tests/tools.test.ts b/mcp/tests/tools.test.ts index 2bba516c..9526fd2e 100644 --- a/mcp/tests/tools.test.ts +++ b/mcp/tests/tools.test.ts @@ -7,9 +7,6 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { registerTools } from "../src/tools.js"; import type { DataSource } from "../src/data-source.js"; import type { - Issue, - PullRequest, - WorkflowRun, DashboardSummary, RateLimitInfo, } from "../../src/shared/types.js"; diff --git a/package.json b/package.json index 2cc58472..8d3187e1 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,9 @@ "test": "vitest run --config vitest.workspace.ts", "test:watch": "vitest --config vitest.workspace.ts", "deploy": "wrangler deploy", - "typecheck": "tsc --build src/shared/tsconfig.json && tsc --noEmit && tsc --build mcp/tsconfig.json", + "typecheck": "tsc --build src/shared/tsconfig.json && tsc --noEmit && tsc --build mcp/tsconfig.json && tsc -p tsconfig.lint.json", + "lint": "oxlint --type-aware --tsconfig tsconfig.lint.json --deny-warnings src tests e2e mcp/tests vite.config.ts && oxlint --type-aware --tsconfig mcp/tsconfig.json --deny-warnings mcp/src", + "lint:fix": "oxlint --type-aware --tsconfig tsconfig.lint.json --fix src tests e2e mcp/tests vite.config.ts && oxlint --type-aware --tsconfig mcp/tsconfig.json --fix mcp/src", "test:e2e": "E2E_PORT=$(node -e \"const s=require('net').createServer();s.listen(0,()=>{console.log(s.address().port);s.close()})\") playwright test", "test:waf": "bash scripts/waf-smoke-test.sh", "test:status-smoke": "vitest run --config vitest.smoke.config.ts", @@ -45,6 +47,8 @@ "daisyui": "5.7.47", "fake-indexeddb": "6.2.5", "happy-dom": "21.0.4", + "oxlint": "1.89.0", + "oxlint-tsgolint": "7.0.2004", "tailwindcss": "4.3.3", "typescript": "7.0.2", "vite": "8.3.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9eb34045..5bd73179 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -236,6 +236,12 @@ importers: happy-dom: specifier: 21.0.4 version: 21.0.4 + oxlint: + specifier: 1.89.0 + version: 1.89.0(oxlint-tsgolint@7.0.2004) + oxlint-tsgolint: + specifier: 7.0.2004 + version: 7.0.2004 tailwindcss: specifier: 4.3.3 version: 4.3.3 @@ -1403,6 +1409,158 @@ packages: '@oxc-project/types@0.155.0': resolution: {integrity: sha512-SeE8JPwW1xs1tHeNycjUtUBdhorRa8o4jlvjwk49R7/Z291i+4DQa7JJIgOm/TaYQZx+QrPQbVJ/9c8dMIZN8Q==} + '@oxlint-tsgolint/darwin-arm64@7.0.2004': + resolution: {integrity: sha512-uJk3ttju7Lz+Nv8WG4CsLyewoL1qf/Ny8S8OksJ7Bm/F14Tc9gMfW6arM1PCc57IzH/X/I79YsCWTgxX1FKibQ==} + cpu: [arm64] + os: [darwin] + + '@oxlint-tsgolint/darwin-x64@7.0.2004': + resolution: {integrity: sha512-0BFfHTzDxNDFPcu0UZAXT6CyCJHAXM0dZveyDb4KEHa2qF/DSnOKOrmvK/wFuFol9kvijbGM9JfuOsor+zWXRw==} + cpu: [x64] + os: [darwin] + + '@oxlint-tsgolint/linux-arm64@7.0.2004': + resolution: {integrity: sha512-TAehQc+qdRXyDN3nl/r/3/oPrBVrbtrDeGMkFyG6mf+XphpoJ2lAMVFLclyvrVZCw02RbKROjyw8h72XwQQHcw==} + cpu: [arm64] + os: [linux] + + '@oxlint-tsgolint/linux-x64@7.0.2004': + resolution: {integrity: sha512-LPunZvm6ZbWPfHMAyfZf9ci3HHvNEzLejO8zdqO3GoVGoSEHqqufHUD7+OgeatVSaJP7uXDJ2HaNOHIoH7go4Q==} + cpu: [x64] + os: [linux] + + '@oxlint-tsgolint/win32-arm64@7.0.2004': + resolution: {integrity: sha512-FVWplzDImWhiuawnIZVETaQecv4GWom6Jv4Fx2xj7hhXXDZ5okEgiw1gTCImHTIQsi2ycC5oSxVwrn69bMh7iw==} + cpu: [arm64] + os: [win32] + + '@oxlint-tsgolint/win32-x64@7.0.2004': + resolution: {integrity: sha512-7PsxuUx11Ry9DYTWcljTzRbmZY9B6O9fFFfZV+aodQEMy6pfRT3fhoQRv9PtGN/89z1pPz3nFKrsFm6WqNtX7w==} + cpu: [x64] + os: [win32] + + '@oxlint/binding-android-arm-eabi@1.89.0': + resolution: {integrity: sha512-Pflpba5F3gRAQ12sWglRxvWTHEdAusNDvmi4Y5N1T5SY1AGkM7AixOnET8qkrnLJ/F32qAlNokO6eCknT8tmnw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [android] + + '@oxlint/binding-android-arm64@1.89.0': + resolution: {integrity: sha512-dYmyD1x7LaPlb79vZWUcpTShk8dI9z1I+IubtqrBxWNJaDhQdPHwcsvg7q5StTU4xWyd9AwPfLaTYFZY8NZgtQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [android] + + '@oxlint/binding-darwin-arm64@1.89.0': + resolution: {integrity: sha512-Z/oxOPiIqiS7fItRdxaaOEC+6GD3OpGi0IxoR0dMefzQHolsKLzScw2DNcu/5gUPok3tv+G9mslvYB5bo3i0qg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [darwin] + + '@oxlint/binding-darwin-x64@1.89.0': + resolution: {integrity: sha512-eAjTkHSjAxrdCPJxO6y5sPQL5pYLKb2kvxZz9UU7tXnOZk9I/HLtkvx9S7GHY883k+AmL/eC7mqFt+w7WCwk0w==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [darwin] + + '@oxlint/binding-freebsd-x64@1.89.0': + resolution: {integrity: sha512-0lNCA9Tl1n1FKpqy2/9ckp0kIuSrtJ/l9bMRgaEhOtM7TsOHshFuwOcvW8oA9teXLMOJT61LjEKWiaHDFGxF/w==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [freebsd] + + '@oxlint/binding-linux-arm-gnueabihf@1.89.0': + resolution: {integrity: sha512-OTFEvi9W+JczaZD1Caj17SGCoW8H7TE+fvx0D7ATEWa1Lohn91UMxFQ6r145SiGy/yCxeIwptMys/RAM7gSVSQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@oxlint/binding-linux-arm-musleabihf@1.89.0': + resolution: {integrity: sha512-fRxgNHvBLswj6MrhW2uBq5UDhPRQlCbHeq/Nf8yuG9zOxhDsXqX/mi2PX1axgsQxMm88el7HLiJAzglAnflYxw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@oxlint/binding-linux-arm64-gnu@1.89.0': + resolution: {integrity: sha512-v9ENzHvwrQoYSWTtviH1pOYc7R9UovDxVofnck50cNmPihRRTcrg5X0UlRbLOZ7IVtxPOlh2hb7kDO+FpE8SfQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@oxlint/binding-linux-arm64-musl@1.89.0': + resolution: {integrity: sha512-vfffe8mQ484AzVadlUOFpgL+JDwhvs9hrzxTgQP1FVfi4ZEUUYeffXlzC9dFV7Dgnu5s/KrNKvfmG6HxBd/ISQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@oxlint/binding-linux-ppc64-gnu@1.89.0': + resolution: {integrity: sha512-Buonlp4hVS7RGNP5M7bPpGNQrenyzA2C64JcO/oz9C1c6dGOXJ7VEAnaiAMY7voou0JYyCJdvDVlFQc5DZX3DQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ppc64] + os: [linux] + libc: [glibc] + + '@oxlint/binding-linux-riscv64-gnu@1.89.0': + resolution: {integrity: sha512-1eVwJJrJ3lYIPT+cm7BcBBZZXY6IQZP/oyonaruTor/MrVyWOpvnwt1oD5CLdsHg5aVBIxXodQSvt+1gK6ck5w==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [riscv64] + os: [linux] + libc: [glibc] + + '@oxlint/binding-linux-riscv64-musl@1.89.0': + resolution: {integrity: sha512-fRQQsKUGShdEL5Fl9o9uhj3grkZbeXKLv0icQ5tspUCNYSDy8wzzEcP1WC2bKdTQ0rSszbKlO3iiHORxV22DLg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [riscv64] + os: [linux] + libc: [musl] + + '@oxlint/binding-linux-s390x-gnu@1.89.0': + resolution: {integrity: sha512-dEtYjIy6+fHcjKklsmtmMkZRhwHr2UbzjmpvuPtQYSeN9awQ2hx5JLms5Wvri+8P/NZtD8v5hfgHALUql+/Ycg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [s390x] + os: [linux] + libc: [glibc] + + '@oxlint/binding-linux-x64-gnu@1.89.0': + resolution: {integrity: sha512-hqjwIj5KOYM8Wjef/p7IruNi1iByLhSzbMBk62y22P/E8q7Jj0Pp+DeUTKTRYyZYCDtU1wEGlnWOnttHbyNIww==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@oxlint/binding-linux-x64-musl@1.89.0': + resolution: {integrity: sha512-iAQN3e6o9UgUCcdGwqRx/jYcKbG3HK7ur3rH6lTqVcQeNGZ85AeWIg6cgn/edwFQ0ofEZZItMwkzyCVTahnvEA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + libc: [musl] + + '@oxlint/binding-openharmony-arm64@1.89.0': + resolution: {integrity: sha512-MNxjEByz3N/7Q4qFQuPWvc14TpN9LoD3pECEDsJTZbP/wyB7U+hduUXEl7QAbbgVezFwsb9sWtNUO6XVBndOhg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [openharmony] + + '@oxlint/binding-win32-arm64-msvc@1.89.0': + resolution: {integrity: sha512-xxe+i9wfuFso/VnoL4mfj0UlzE+cfCFiUB06vkXCMyQdgVVmItF5FfAF4tATAktSU6uHruWR+FjqvAT9cHZZzg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [win32] + + '@oxlint/binding-win32-ia32-msvc@1.89.0': + resolution: {integrity: sha512-saFy07cO94E664glwgLmKLI40HgTL1PY86y4T6+ud4niX4H0Kdqjcmqmjps7mQNdBytV5guGbXDdyQtRfeLbLA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ia32] + os: [win32] + + '@oxlint/binding-win32-x64-msvc@1.89.0': + resolution: {integrity: sha512-hLFJ/o0f/dTJh/EW0vmcbREYSQO9tYgfiAAlsOkiLFiJuRRWvYtFELUXN5o2ijpSo/tlO1n+YlWN58tZwPG18A==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [win32] + '@playwright/test@1.63.0': resolution: {integrity: sha512-oxMK4vllB9RK5NQ2l1pq1IfOf2AvnEuj/vYGDj0H2nMtmtZpKtCwt/l00GEO6xjGfpBNAvjovvYdCm50dRQkpQ==} engines: {node: '>=20'} @@ -2776,6 +2934,23 @@ packages: once@1.4.0: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + oxlint-tsgolint@7.0.2004: + resolution: {integrity: sha512-vQ9WDF3fiZJvRdSDosNOflerOCOpwol6vWzVDxW76RcU19cjTh7engvkHLvmv+tzedR8fAiJUVUGr6IVZdkzXQ==} + hasBin: true + + oxlint@1.89.0: + resolution: {integrity: sha512-a25hkfo61okGPvJz432fRIPoxlKtNnOVy9w4rzrmGgNm4iVTPwpSQlmdqNWnp6p9QyyPVfAZRgnf5XvSBZFk/A==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + peerDependencies: + oxlint-tsgolint: '>=7.0.2003' + vite-plus: '*' + peerDependenciesMeta: + oxlint-tsgolint: + optional: true + vite-plus: + optional: true + parse5@7.3.0: resolution: {integrity: sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==} @@ -4144,6 +4319,81 @@ snapshots: '@oxc-project/types@0.155.0': {} + '@oxlint-tsgolint/darwin-arm64@7.0.2004': + optional: true + + '@oxlint-tsgolint/darwin-x64@7.0.2004': + optional: true + + '@oxlint-tsgolint/linux-arm64@7.0.2004': + optional: true + + '@oxlint-tsgolint/linux-x64@7.0.2004': + optional: true + + '@oxlint-tsgolint/win32-arm64@7.0.2004': + optional: true + + '@oxlint-tsgolint/win32-x64@7.0.2004': + optional: true + + '@oxlint/binding-android-arm-eabi@1.89.0': + optional: true + + '@oxlint/binding-android-arm64@1.89.0': + optional: true + + '@oxlint/binding-darwin-arm64@1.89.0': + optional: true + + '@oxlint/binding-darwin-x64@1.89.0': + optional: true + + '@oxlint/binding-freebsd-x64@1.89.0': + optional: true + + '@oxlint/binding-linux-arm-gnueabihf@1.89.0': + optional: true + + '@oxlint/binding-linux-arm-musleabihf@1.89.0': + optional: true + + '@oxlint/binding-linux-arm64-gnu@1.89.0': + optional: true + + '@oxlint/binding-linux-arm64-musl@1.89.0': + optional: true + + '@oxlint/binding-linux-ppc64-gnu@1.89.0': + optional: true + + '@oxlint/binding-linux-riscv64-gnu@1.89.0': + optional: true + + '@oxlint/binding-linux-riscv64-musl@1.89.0': + optional: true + + '@oxlint/binding-linux-s390x-gnu@1.89.0': + optional: true + + '@oxlint/binding-linux-x64-gnu@1.89.0': + optional: true + + '@oxlint/binding-linux-x64-musl@1.89.0': + optional: true + + '@oxlint/binding-openharmony-arm64@1.89.0': + optional: true + + '@oxlint/binding-win32-arm64-msvc@1.89.0': + optional: true + + '@oxlint/binding-win32-ia32-msvc@1.89.0': + optional: true + + '@oxlint/binding-win32-x64-msvc@1.89.0': + optional: true + '@playwright/test@1.63.0': dependencies: playwright: 1.63.0 @@ -5323,6 +5573,38 @@ snapshots: dependencies: wrappy: 1.0.2 + oxlint-tsgolint@7.0.2004: + optionalDependencies: + '@oxlint-tsgolint/darwin-arm64': 7.0.2004 + '@oxlint-tsgolint/darwin-x64': 7.0.2004 + '@oxlint-tsgolint/linux-arm64': 7.0.2004 + '@oxlint-tsgolint/linux-x64': 7.0.2004 + '@oxlint-tsgolint/win32-arm64': 7.0.2004 + '@oxlint-tsgolint/win32-x64': 7.0.2004 + + oxlint@1.89.0(oxlint-tsgolint@7.0.2004): + optionalDependencies: + '@oxlint/binding-android-arm-eabi': 1.89.0 + '@oxlint/binding-android-arm64': 1.89.0 + '@oxlint/binding-darwin-arm64': 1.89.0 + '@oxlint/binding-darwin-x64': 1.89.0 + '@oxlint/binding-freebsd-x64': 1.89.0 + '@oxlint/binding-linux-arm-gnueabihf': 1.89.0 + '@oxlint/binding-linux-arm-musleabihf': 1.89.0 + '@oxlint/binding-linux-arm64-gnu': 1.89.0 + '@oxlint/binding-linux-arm64-musl': 1.89.0 + '@oxlint/binding-linux-ppc64-gnu': 1.89.0 + '@oxlint/binding-linux-riscv64-gnu': 1.89.0 + '@oxlint/binding-linux-riscv64-musl': 1.89.0 + '@oxlint/binding-linux-s390x-gnu': 1.89.0 + '@oxlint/binding-linux-x64-gnu': 1.89.0 + '@oxlint/binding-linux-x64-musl': 1.89.0 + '@oxlint/binding-openharmony-arm64': 1.89.0 + '@oxlint/binding-win32-arm64-msvc': 1.89.0 + '@oxlint/binding-win32-ia32-msvc': 1.89.0 + '@oxlint/binding-win32-x64-msvc': 1.89.0 + oxlint-tsgolint: 7.0.2004 + parse5@7.3.0: dependencies: entities: 6.0.1 diff --git a/renovate.json b/renovate.json index 1f7c3e71..5f1b4487 100644 --- a/renovate.json +++ b/renovate.json @@ -2,5 +2,11 @@ "$schema": "https://docs.renovatebot.com/renovate-schema.json", "description": [ "Managed by khepri-deps/renovate — global config provides weekly Monday schedule, 14-day release cooldown, and vulnerability alert bypass." + ], + "packageRules": [ + { + "matchPackageNames": ["oxlint", "oxlint-tsgolint"], + "groupName": "oxlint" + } ] } diff --git a/tsconfig.lint.json b/tsconfig.lint.json new file mode 100644 index 00000000..0a5375b1 --- /dev/null +++ b/tsconfig.lint.json @@ -0,0 +1,16 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "noEmit": true, + "allowImportingTsExtensions": true + }, + "include": [ + "src/**/*", + "tests/**/*", + "e2e/**/*", + "mcp/tests/**/*.ts", + "vite.config.ts", + "vite-plugins/**/*", + "scripts/**/*.ts" + ] +} From bac1eed5797734e5025c0a86664941dc7eb26926 Mon Sep 17 00:00:00 2001 From: Will Gordon Date: Tue, 27 Oct 2026 21:50:14 -0400 Subject: [PATCH 2/7] chore(lint): fixes oxlint findings and enforces CI --- .github/workflows/ci.yml | 1 + .github/workflows/deploy.yml | 1 + CONTRIBUTING.md | 8 +++- mcp/src/octokit.ts | 2 +- mcp/src/ws-relay.ts | 2 +- mcp/tests/octokit.test.ts | 6 +-- mcp/tests/ws-relay.test.ts | 2 +- prek.toml | 9 +++++ src/app/components/dashboard/ActionsTab.tsx | 4 +- .../components/dashboard/DashboardPage.tsx | 21 +++++----- .../components/dashboard/DependenciesTab.tsx | 4 +- src/app/components/dashboard/IgnoreBadge.tsx | 1 + src/app/components/dashboard/IssuesTab.tsx | 4 +- .../components/dashboard/JiraAssignedTab.tsx | 12 +++--- .../components/dashboard/JiraFieldValue.tsx | 2 +- .../components/dashboard/PullRequestsTab.tsx | 10 ++--- src/app/components/dashboard/TrackedTab.tsx | 2 +- .../components/onboarding/RepoSelector.tsx | 4 +- .../components/settings/JiraFieldPicker.tsx | 8 ++-- src/app/components/settings/SettingsPage.tsx | 12 +++--- src/app/components/shared/CustomTabModal.tsx | 4 +- .../components/shared/NotificationDrawer.tsx | 2 +- src/app/components/shared/ToastContainer.tsx | 1 + src/app/lib/dependency-dashboard.ts | 2 +- src/app/lib/dependency-detection.ts | 30 +++++++-------- src/app/lib/jira-utils.ts | 2 +- src/app/lib/settings-transfer.ts | 16 ++++---- src/app/lib/use-credential-import.ts | 4 +- src/app/pages/LoginPage.tsx | 8 ++-- src/app/services/api-usage.ts | 2 +- src/app/services/api.ts | 13 ++++--- src/app/services/github.ts | 6 +-- src/app/services/jira-client.ts | 2 +- src/app/services/poll.ts | 4 +- src/app/stores/auth.ts | 10 ++--- src/app/stores/cache.ts | 4 +- src/app/stores/view.ts | 5 ++- src/shared/schemas.ts | 2 +- src/worker/index.ts | 12 +++--- src/worker/sentry.ts | 2 +- .../steps/dependency-exclusions.steps.tsx | 4 +- .../steps/org-order-stability.steps.tsx | 22 +++++------ tests/app/lib/proxy.test.ts | 4 +- tests/components/DashboardPage.test.tsx | 10 +---- tests/components/LoginPage.test.tsx | 6 +-- .../dashboard/JiraAssignedTab.test.tsx | 16 ++++---- .../onboarding/RepoSelector.test.tsx | 38 +++++++++---------- .../components/settings/JiraSection.test.tsx | 10 ++--- .../components/settings/SettingsPage.test.tsx | 14 +++---- .../components/settings/SettingsTOC.test.tsx | 4 +- tests/lib/dependency-detection.test.ts | 4 +- tests/lib/pat.test.ts | 2 +- tests/lib/sentry.test.ts | 6 +-- tests/lib/settings-transfer.test.ts | 16 ++++---- tests/lib/tabFilters.test.ts | 2 +- tests/services/api-optimization.test.ts | 2 +- tests/services/api-usage.test.ts | 10 ++--- tests/services/api.test.ts | 4 +- tests/services/events-poll.test.ts | 4 +- tests/services/jira-keys.test.ts | 4 +- tests/setup.ts | 6 +-- tests/stores/auth.test.ts | 2 +- tests/stores/view.test.ts | 34 ++++++++--------- tests/worker/crypto.test.ts | 2 +- tests/worker/csp-report.test.ts | 2 +- tests/worker/jira-oauth.test.ts | 2 +- tests/worker/unseal.test.ts | 2 +- 67 files changed, 248 insertions(+), 230 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2cf02df9..4c3e4112 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,7 @@ jobs: - name: Verify CSP inline script hash run: bash scripts/verify-csp-hash.sh - run: pnpm run typecheck + - run: pnpm lint - run: pnpm test # No `playwright install` step: playwright.config.ts uses channel: "chrome", # which resolves to ubuntu-latest's preinstalled Google Chrome — Playwright's diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 2e601eeb..ac5a6254 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -17,6 +17,7 @@ jobs: cache: pnpm - run: pnpm install --frozen-lockfile - run: pnpm run typecheck + - run: pnpm lint - run: pnpm test - name: Verify CSP inline script hash run: bash scripts/verify-csp-hash.sh diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 320c2130..6ef2d21f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -37,6 +37,8 @@ pnpm test # unit tests (Vitest — root + mcp/) pnpm test:e2e # Playwright E2E tests (chromium) pnpm test:status-smoke # Live-network check that githubstatus.com still reports the tracked component names (also runs on a weekly schedule in CI) pnpm run typecheck # TypeScript validation (root + mcp/) +pnpm lint # Type-aware lint check (oxlint — root + mcp/) +pnpm lint:fix # Auto-fix safe lint findings (oxlint) pnpm run screenshot # Capture dashboard screenshot (saves to docs/) pnpm mcp:serve # Start the MCP server (requires GITHUB_TOKEN) ``` @@ -47,7 +49,7 @@ To test MCP tools interactively, use the MCP Inspector: npx @modelcontextprotocol/inspector tsx mcp/src/index.ts ``` -CI runs typecheck, unit tests, and E2E tests on every PR. Make sure they pass locally before pushing. +CI runs typecheck, lint (`oxlint`), unit tests, and E2E tests on every PR, and lint is also enforced pre-commit via `prek` alongside typecheck and unit tests. Make sure they pass locally before pushing. To run a specific test file: @@ -88,6 +90,8 @@ Branch from `main`. Use one of these prefixes: - `feat/` — new functionality - `fix/` — bug fixes +- `perf/` — performance changes +- `ci/` — CI/release workflow changes - `docs/` — documentation only - `refactor/` — code changes with no behavior change - `test/` — test additions or fixes @@ -99,7 +103,7 @@ Commits follow [Conventional Commits](https://www.conventionalcommits.org/): type(scope): description ``` -Scope is optional. Use present-indicative mood: "adds feature", not "add feature" or "added feature". +Scope is optional. Use imperative mood: "add feature", not "adds feature" or "added feature". ## Releasing the MCP server diff --git a/mcp/src/octokit.ts b/mcp/src/octokit.ts index 6059ae2a..6f506818 100644 --- a/mcp/src/octokit.ts +++ b/mcp/src/octokit.ts @@ -106,7 +106,7 @@ export async function validateTokenScopes(): Promise { try { const response = await client.request("GET /user"); - const login = String((response.data as { login?: string }).login ?? "unknown"); + const login = (response.data as { login?: string }).login ?? "unknown"; const rawScopeHeader = (response.headers as Record)["x-oauth-scopes"]; if (rawScopeHeader === undefined) { diff --git a/mcp/src/ws-relay.ts b/mcp/src/ws-relay.ts index 83845922..6f497f89 100644 --- a/mcp/src/ws-relay.ts +++ b/mcp/src/ws-relay.ts @@ -228,7 +228,7 @@ export function startWebSocketServer(): WebSocketServer | null { info: { origin: string; req: IncomingMessage; secure: boolean }, callback: (res: boolean, code?: number, message?: string) => void ): void { - const origin = info.req.headers.origin as string | undefined; + const origin = info.req.headers.origin; if (!isOriginAllowed(origin)) { console.error(`[mcp/ws] Rejected connection from disallowed origin: ${origin ?? "(none)"}`); callback(false, 403, "Origin not allowed"); diff --git a/mcp/tests/octokit.test.ts b/mcp/tests/octokit.test.ts index a0a6c356..82cbd9f5 100644 --- a/mcp/tests/octokit.test.ts +++ b/mcp/tests/octokit.test.ts @@ -14,7 +14,7 @@ describe("createOctokitClient — write guard hook", () => { let capturedMethod: string | undefined; client.hook.wrap("request", async (_request, options) => { capturedMethod = (options.method ?? "GET").toUpperCase(); - return { data: {}, headers: {}, status: 200, url: String(options.url) }; + return { data: {}, headers: {}, status: 200, url: options.url }; }); await client.request("GET /user"); @@ -27,8 +27,8 @@ describe("createOctokitClient — write guard hook", () => { let capturedUrl: string | undefined; client.hook.wrap("request", async (_request, options) => { - capturedUrl = String(options.url); - return { data: {}, headers: {}, status: 200, url: String(options.url) }; + capturedUrl = options.url; + return { data: {}, headers: {}, status: 200, url: options.url }; }); await client.request("POST /graphql", { query: "{ viewer { login } }" }); diff --git a/mcp/tests/ws-relay.test.ts b/mcp/tests/ws-relay.test.ts index d1882bd9..1dd90bb5 100644 --- a/mcp/tests/ws-relay.test.ts +++ b/mcp/tests/ws-relay.test.ts @@ -45,7 +45,7 @@ function waitForMessage(ws: WebSocket, timeout = 2000): Promise { const t = setTimeout(() => reject(new Error("Timeout waiting for message")), timeout); ws.once("message", (data) => { clearTimeout(t); - resolve(data.toString()); + resolve((data as Buffer).toString()); }); }); } diff --git a/prek.toml b/prek.toml index 7448d0b1..25974beb 100644 --- a/prek.toml +++ b/prek.toml @@ -31,6 +31,15 @@ pass_filenames = false always_run = true priority = 0 +[[repos.hooks]] +id = "lint" +name = "oxlint" +language = "system" +entry = "pnpm lint" +pass_filenames = false +always_run = true +priority = 0 + [[repos.hooks]] id = "test" name = "Vitest tests" diff --git a/src/app/components/dashboard/ActionsTab.tsx b/src/app/components/dashboard/ActionsTab.tsx index 87d96642..cc8da239 100644 --- a/src/app/components/dashboard/ActionsTab.tsx +++ b/src/app/components/dashboard/ActionsTab.tsx @@ -90,7 +90,7 @@ function groupRuns(runs: WorkflowRun[]): RepoGroup[] { } function sortWorkflowsByStatus(workflows: WorkflowGroup[]): WorkflowGroup[] { - return [...workflows].sort((a, b) => { + return workflows.toSorted((a, b) => { const priorityOf = (wf: WorkflowGroup): number => { const latest = wf.runs[0]; if (!latest) return 2; @@ -336,7 +336,7 @@ export default function ActionsTab(props: ActionsTabProps) { {(wfGroup) => { const wfKey = `${repoGroup.repoFullName}:${wfGroup.workflowId}`; - const isWfExpanded = () => !!expandedWorkflows[wfKey]; + const isWfExpanded = () => expandedWorkflows[wfKey] ?? false; return (
diff --git a/src/app/components/dashboard/DashboardPage.tsx b/src/app/components/dashboard/DashboardPage.tsx index 2345a7c1..653f0785 100644 --- a/src/app/components/dashboard/DashboardPage.tsx +++ b/src/app/components/dashboard/DashboardPage.tsx @@ -157,7 +157,7 @@ function loadDepMetaCache(): Map { const map = new Map(); for (const [k, v] of Object.entries(parsed)) { const id = Number(k); - if (!isNaN(id) && v && typeof v === "object") map.set(id, v as VersionInfo); + if (!isNaN(id) && v && typeof v === "object") map.set(id, v); } return map; } catch { @@ -1353,10 +1353,10 @@ export default function DashboardPage() { try { const dashboardIssues = findDashboardIssues(dashboardData.issues, trackedBotLogins()); const activeNodeIds = new Set(dashboardIssues.map((di) => di.nodeId)); - for (const k of [..._dashboardBodyCache.keys()]) { + for (const k of _dashboardBodyCache.keys()) { if (!activeNodeIds.has(k)) _dashboardBodyCache.delete(k); } - for (const k of [..._dashboardBodyFailureCooldown.keys()]) { + for (const k of _dashboardBodyFailureCooldown.keys()) { if (!activeNodeIds.has(k)) _dashboardBodyFailureCooldown.delete(k); } @@ -1445,7 +1445,7 @@ export default function DashboardPage() { // PR happens to trigger a fetch would incorrectly stay excluded on a stale // cooldown entry for up to DEP_BODY_FAILURE_COOLDOWN_MS. const depPrIds = new Set(depPrs.map((pr) => pr.id)); - for (const k of [..._depBodyFailureCooldown.keys()]) { + for (const k of _depBodyFailureCooldown.keys()) { if (!depPrIds.has(k)) _depBodyFailureCooldown.delete(k); } @@ -1488,7 +1488,7 @@ export default function DashboardPage() { if (parsed) merged.set(id, parsed); } // Prune entries for PRs no longer in the dependency set - for (const k of [...merged.keys()]) { + for (const k of merged.keys()) { if (!depPrIds.has(k)) merged.delete(k); } setDepMeta(merged); @@ -1529,8 +1529,9 @@ export default function DashboardPage() { if (Array.isArray(errObj.errors)) { for (const item of errObj.errors) { if (item && typeof item === "object") { - const type = (item as Record).type; - const msg = String((item as Record).message ?? ""); + const itemObj = item as Record; + const type = itemObj.type; + const msg = typeof itemObj.message === "string" ? itemObj.message : ""; if ( type === "FORBIDDEN" || type === "INSUFFICIENT_SCOPES" || @@ -1552,7 +1553,7 @@ export default function DashboardPage() { function isStaleCommitError(err: unknown): boolean { if (!err || typeof err !== "object") return false; const errObj = err as Record; - const msg = err instanceof Error ? err.message : String(errObj.message ?? ""); + const msg = err instanceof Error ? err.message : typeof errObj.message === "string" ? errObj.message : ""; return /commitOID|was not part of the pull request|pull request head|outdated|end of the branch/i.test(msg); } @@ -1745,8 +1746,8 @@ export default function DashboardPage() { counts={tabCounts()} enableTracking={config.enableTracking} enableActions={config.enableActions} - enableJira={!!config.jira?.enabled} - jiraExpired={Boolean(config.jira?.enabled && !isJiraAuthenticated())} + enableJira={config.jira?.enabled ?? false} + jiraExpired={(config.jira?.enabled ?? false) && !isJiraAuthenticated()} enableDependencies={enableDependencies()} customTabs={config.customTabs.filter((t) => config.enableActions || t.baseType !== "actions").map((t) => ({ id: t.id, name: t.name, isUnscoped: isTabUnscoped(t) }))} onAddTab={() => setShowCustomTabModal(true)} diff --git a/src/app/components/dashboard/DependenciesTab.tsx b/src/app/components/dashboard/DependenciesTab.tsx index 6ff6227a..31d4f190 100644 --- a/src/app/components/dashboard/DependenciesTab.tsx +++ b/src/app/components/dashboard/DependenciesTab.tsx @@ -142,11 +142,11 @@ export default function DependenciesTab(props: DependenciesTabProps) { const activeFilters = createMemo(() => ({ ...DEP_FILTER_DEFAULTS, - ...(viewState.tabFilters.dependencies ?? {}), + ...viewState.tabFilters.dependencies, })); const botOptions = createMemo(() => { - const logins = [...new Set(props.pullRequests.map((pr) => pr.userLogin))].sort(); + const logins = [...new Set(props.pullRequests.map((pr) => pr.userLogin))].toSorted(); return { label: "Bot", field: "bot", diff --git a/src/app/components/dashboard/IgnoreBadge.tsx b/src/app/components/dashboard/IgnoreBadge.tsx index ecf3acbd..d93951db 100644 --- a/src/app/components/dashboard/IgnoreBadge.tsx +++ b/src/app/components/dashboard/IgnoreBadge.tsx @@ -15,6 +15,7 @@ function typeIcon(type: IgnoredItem["type"]): string { case "pullRequest": return "⌥"; case "workflowRun": + default: return "▶"; } } diff --git a/src/app/components/dashboard/IssuesTab.tsx b/src/app/components/dashboard/IssuesTab.tsx index 5eb2626e..05cf28b1 100644 --- a/src/app/components/dashboard/IssuesTab.tsx +++ b/src/app/components/dashboard/IssuesTab.tsx @@ -133,7 +133,7 @@ export default function IssuesTab(props: IssuesTabProps) { if (effectiveScope === "involves_me" && !isInvolvedItem(issue)) return false; if (tabFilter.role !== "all") { - if (!roles.includes(tabFilter.role as "author" | "assignee")) return false; + if (!roles.includes(tabFilter.role)) return false; } if (tabFilter.comments !== "all") { @@ -157,7 +157,7 @@ export default function IssuesTab(props: IssuesTabProps) { }); const { field, direction } = viewState.globalSort; - items = [...items].sort((a, b) => { + items = items.toSorted((a, b) => { let cmp = 0; switch (field as SortField) { case "repo": diff --git a/src/app/components/dashboard/JiraAssignedTab.tsx b/src/app/components/dashboard/JiraAssignedTab.tsx index b3d74f9d..8b54c2b7 100644 --- a/src/app/components/dashboard/JiraAssignedTab.tsx +++ b/src/app/components/dashboard/JiraAssignedTab.tsx @@ -202,7 +202,7 @@ export default function JiraAssignedTab(props: JiraAssignedTabProps) { }); } - const expandByDefault = () => !!(config.jira?.expandIssueDetails); + const expandByDefault = () => config.jira?.expandIssueDetails ?? false; const pinnedJiraKeys = createMemo(() => new Set( @@ -256,14 +256,14 @@ export default function JiraAssignedTab(props: JiraAssignedTabProps) { break; } case "updated": { - const aUp = String(a.fields.updated ?? ""); - const bUp = String(b.fields.updated ?? ""); + const aUp = a.fields.updated ?? ""; + const bUp = b.fields.updated ?? ""; cmp = aUp < bUp ? -1 : aUp > bUp ? 1 : 0; break; } case "created": { - const aCr = String(a.fields.created ?? ""); - const bCr = String(b.fields.created ?? ""); + const aCr = a.fields.created ?? ""; + const bCr = b.fields.created ?? ""; cmp = aCr < bCr ? -1 : aCr > bCr ? 1 : 0; break; } @@ -474,7 +474,7 @@ export default function JiraAssignedTab(props: JiraAssignedTabProps) { fallback={} > {type().name}; for (const key of ["displayName", "name", "value", "label"]) { - if (typeof obj[key] === "string") return obj[key] as string; + if (typeof obj[key] === "string") return obj[key]; } } const json = JSON.stringify(value); diff --git a/src/app/components/dashboard/PullRequestsTab.tsx b/src/app/components/dashboard/PullRequestsTab.tsx index 51518605..434e5b27 100644 --- a/src/app/components/dashboard/PullRequestsTab.tsx +++ b/src/app/components/dashboard/PullRequestsTab.tsx @@ -180,7 +180,7 @@ export default function PullRequestsTab(props: PullRequestsTabProps) { const isEnriched = pr.enriched !== false; if (tabFilters.role !== "all") { // Role depends on assigneeLogins/reviewerLogins (heavy), but "author" is light - if (isEnriched && !roles.includes(tabFilters.role as "author" | "reviewer" | "assignee")) return false; + if (isEnriched && !roles.includes(tabFilters.role)) return false; if (!isEnriched && tabFilters.role === "author" && !roles.includes("author")) return false; } if (tabFilters.reviewDecision !== "all") { @@ -223,7 +223,7 @@ export default function PullRequestsTab(props: PullRequestsTabProps) { }); const { field, direction } = viewState.globalSort; - items = [...items].sort((a, b) => { + items = items.toSorted((a, b) => { let cmp = 0; switch (field as SortField) { case "repo": @@ -620,10 +620,10 @@ export default function PullRequestsTab(props: PullRequestsTabProps) { {(() => { const titleKeys = new Set(extractJiraKeys(pr.title)); const branchKeys = new Set(extractJiraKeys(pr.headRef ?? "")); - const annotated = [...new Set([...titleKeys, ...branchKeys])].map((key) => ({ + const annotated = [...new Set([...titleKeys, ...branchKeys])].map((key): { key: string; source: "title" | "branch" | "title & branch" } => ({ key, - source: (titleKeys.has(key) && branchKeys.has(key) ? "title & branch" - : titleKeys.has(key) ? "title" : "branch") as "title" | "branch" | "title & branch", + source: titleKeys.has(key) && branchKeys.has(key) ? "title & branch" + : titleKeys.has(key) ? "title" : "branch", })); return ( diff --git a/src/app/components/dashboard/TrackedTab.tsx b/src/app/components/dashboard/TrackedTab.tsx index eb3063ee..9571272d 100644 --- a/src/app/components/dashboard/TrackedTab.tsx +++ b/src/app/components/dashboard/TrackedTab.tsx @@ -212,7 +212,7 @@ export default function TrackedTab(props: TrackedTabProps) { {item.title} - +
{item.repoFullName}{" "} diff --git a/src/app/components/onboarding/RepoSelector.tsx b/src/app/components/onboarding/RepoSelector.tsx index 42e99fce..cb743c52 100644 --- a/src/app/components/onboarding/RepoSelector.tsx +++ b/src/app/components/onboarding/RepoSelector.tsx @@ -362,7 +362,7 @@ export default function RepoSelector(props: RepoSelectorProps) { const states = orgStates(); // Invalidate frozen order when org membership changes (key is order-independent). - const currentKey = [...props.selectedOrgs].sort().join(","); + const currentKey = props.selectedOrgs.toSorted().join(","); if (currentKey !== frozenOrgsKey) { frozenOrder = null; frozenOrgsKey = currentKey; @@ -393,7 +393,7 @@ export default function RepoSelector(props: RepoSelectorProps) { if (states.some((s) => !selectedOrgSet.has(s.org))) return states; // Sort: personal org first, then alphabetically. Capture order to freeze it. - const sorted = [...states].sort((a, b) => { + const sorted = states.toSorted((a, b) => { const aIsUser = a.type === "user" ? 0 : 1; const bIsUser = b.type === "user" ? 0 : 1; if (aIsUser !== bIsUser) return aIsUser - bIsUser; diff --git a/src/app/components/settings/JiraFieldPicker.tsx b/src/app/components/settings/JiraFieldPicker.tsx index 5f0dbe5e..39b0c32d 100644 --- a/src/app/components/settings/JiraFieldPicker.tsx +++ b/src/app/components/settings/JiraFieldPicker.tsx @@ -43,11 +43,11 @@ export default function JiraFieldPicker(props: JiraFieldPickerProps) { try { const result = await props.client.searchJql(jql, { maxResults: 20, fields: ["*all"] }); for (const issue of result.issues) { - const fields = issue.fields as Record; + const issueFields = issue.fields as Record; for (const id of fieldIdSet) { if (id in merged) continue; - if (fields[id] !== undefined && fields[id] !== null) { - merged[id] = fields[id]; + if (issueFields[id] !== undefined && issueFields[id] !== null) { + merged[id] = issueFields[id]; } } } @@ -73,7 +73,7 @@ export default function JiraFieldPicker(props: JiraFieldPickerProps) { const samples = sampleValues(); const sel = selected(); const selOrder = [...sel.keys()]; - return matched.sort((a, b) => { + return matched.toSorted((a, b) => { const aSel = sel.has(a.id); const bSel = sel.has(b.id); if (aSel !== bSel) return aSel ? -1 : 1; diff --git a/src/app/components/settings/SettingsPage.tsx b/src/app/components/settings/SettingsPage.tsx index 6e082876..a41e6168 100644 --- a/src/app/components/settings/SettingsPage.tsx +++ b/src/app/components/settings/SettingsPage.tsx @@ -587,7 +587,7 @@ export default function SettingsPage() { function handleJiraDeepLink() { if (typeof window === "undefined" || window.location.hash !== "#jira") return; const shouldOpenReplace = - config.jira?.authMethod === "token" && (isJiraAuthenticated() || Boolean(config.jira?.enabled)); + config.jira?.authMethod === "token" && (isJiraAuthenticated() || config.jira.enabled); if (shouldOpenReplace) { openReplaceJiraTokenPanel(false, true); } @@ -671,9 +671,9 @@ export default function SettingsPage() { async function handleJiraApiTokenConnect() { const email = jiraApiEmail().trim(); - const token = jiraApiToken().trim(); + const apiToken = jiraApiToken().trim(); const siteUrl = jiraApiSiteUrl(); - if (!email || !token || !siteUrl) { + if (!email || !apiToken || !siteUrl) { setJiraApiError("Email, API token, and site name are all required."); return; } @@ -697,7 +697,7 @@ export default function SettingsPage() { return; } - const sealedToken = await sealApiToken(token, "jira-api-token"); + const sealedToken = await sealApiToken(apiToken, "jira-api-token"); // Validate by making a search request through the proxy const resp = await fetch("/api/jira/proxy", { method: "POST", @@ -1769,7 +1769,7 @@ export default function SettingsPage() { disabled={!isJiraAuthenticated()} onClick={() => { setShowFieldPicker((v) => !v); - setTimeout(() => { (document.querySelector("[data-picker-search]") as HTMLElement | null)?.focus(); }, 0); + setTimeout(() => { document.querySelector("[data-picker-search]")?.focus(); }, 0); }} aria-expanded={showFieldPicker()} > @@ -1800,7 +1800,7 @@ export default function SettingsPage() { disabled={!isJiraAuthenticated()} onClick={() => { setShowScopePicker((v) => !v); - setTimeout(() => { (document.querySelector("[data-picker-search]") as HTMLElement | null)?.focus(); }, 0); + setTimeout(() => { document.querySelector("[data-picker-search]")?.focus(); }, 0); }} aria-expanded={showScopePicker()} > diff --git a/src/app/components/shared/CustomTabModal.tsx b/src/app/components/shared/CustomTabModal.tsx index 9d7cce72..e774d724 100644 --- a/src/app/components/shared/CustomTabModal.tsx +++ b/src/app/components/shared/CustomTabModal.tsx @@ -46,7 +46,7 @@ export default function CustomTabModal(props: CustomTabModalProps) { }); // filterPreset: field → value. Only set keys are stored. const [filterPreset, setFilterPreset] = createSignal>( - { ...(props.editingTab?.filterPreset ?? {}) } + { ...props.editingTab?.filterPreset } ); const [exclusive, setExclusive] = createSignal(props.editingTab?.exclusive ?? false); const [scopeOpen, setScopeOpen] = createSignal(false); @@ -61,7 +61,7 @@ export default function CustomTabModal(props: CustomTabModalProps) { const tab = props.editingTab; setName(tab?.name ?? ""); setBaseType(tab?.baseType ?? "issues"); - setFilterPreset({ ...(tab?.filterPreset ?? {}) }); + setFilterPreset({ ...tab?.filterPreset }); setExclusive(tab?.exclusive ?? false); setScopeOpen(false); setCapError(false); diff --git a/src/app/components/shared/NotificationDrawer.tsx b/src/app/components/shared/NotificationDrawer.tsx index fcdbed42..ef8ef4e7 100644 --- a/src/app/components/shared/NotificationDrawer.tsx +++ b/src/app/components/shared/NotificationDrawer.tsx @@ -17,7 +17,7 @@ interface NotificationDrawerProps { } export default function NotificationDrawer(props: NotificationDrawerProps) { - const sortedNotifications = createMemo(() => getNotifications().slice().reverse()); + const sortedNotifications = createMemo(() => getNotifications().toReversed()); function handleDismissAll() { const current = getNotifications(); diff --git a/src/app/components/shared/ToastContainer.tsx b/src/app/components/shared/ToastContainer.tsx index 3dbad4ca..ba651346 100644 --- a/src/app/components/shared/ToastContainer.tsx +++ b/src/app/components/shared/ToastContainer.tsx @@ -35,6 +35,7 @@ export function severityConfig(severity: NotificationSeverity): SeverityConfig { borderClass: "border-l-warning", }; case "info": + default: return { path: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z", iconClass: "text-info", diff --git a/src/app/lib/dependency-dashboard.ts b/src/app/lib/dependency-dashboard.ts index 0ea5d731..e7a5b975 100644 --- a/src/app/lib/dependency-dashboard.ts +++ b/src/app/lib/dependency-dashboard.ts @@ -72,7 +72,7 @@ export function parseAbandonedSection(body: string): AbandonedDependency[] { const deps: AbandonedDependency[] = []; // Skip header (index 0) and separator (index 1) for (let i = 2; i < tableRows.length; i++) { - const row = tableRows[i]!; + const row = tableRows[i]; // Split on pipe, trim cells, drop leading/trailing empty from outer pipes const cells = row .split("|") diff --git a/src/app/lib/dependency-detection.ts b/src/app/lib/dependency-detection.ts index 0dd1827e..745c4f55 100644 --- a/src/app/lib/dependency-detection.ts +++ b/src/app/lib/dependency-detection.ts @@ -118,7 +118,7 @@ export function extractVersionInfo(title: string): VersionInfo | null { // "Bump X from A to B" or "Bump X from A to B in /dir" const bumpMatch = /^Bump\s+(.+?)\s+from\s+([\w.\-+]+)\s+to\s+([\w.\-+]+)/i.exec(body); if (bumpMatch) { - return { packageName: bumpMatch[1]!, from: bumpMatch[2]!, to: bumpMatch[3]!, updateType: semverUpdateType(bumpMatch[2]!, bumpMatch[3]!) ?? undefined }; + return { packageName: bumpMatch[1], from: bumpMatch[2], to: bumpMatch[3], updateType: semverUpdateType(bumpMatch[2], bumpMatch[3]) ?? undefined }; } // "update all major/non-major dependencies" @@ -128,21 +128,21 @@ export function extractVersionInfo(title: string): VersionInfo | null { // "update X requirement from >=A to >=B" (Dependabot Python) const reqMatch = /^update\s+(.+?)\s+requirement\s+from\s+([^\s]+)\s+to\s+([^\s]+)/i.exec(body); if (reqMatch) { - const from = stripVersionSpecifier(reqMatch[2]!); - const to = stripVersionSpecifier(reqMatch[3]!); - return { packageName: reqMatch[1]!, from, to, updateType: semverUpdateType(from, to) ?? undefined }; + const from = stripVersionSpecifier(reqMatch[2]); + const to = stripVersionSpecifier(reqMatch[3]); + return { packageName: reqMatch[1], from, to, updateType: semverUpdateType(from, to) ?? undefined }; } // "Update dependency X to vY" const depMatch = /^Update\s+dependency\s+(.+?)\s+to\s+(v?[\w.\-+]+)/i.exec(body); - if (depMatch && /^v?\d/.test(depMatch[2]!)) { - return { packageName: depMatch[1]!, to: depMatch[2]! }; + if (depMatch && /^v?\d/.test(depMatch[2])) { + return { packageName: depMatch[1], to: depMatch[2] }; } // "Update X action to vY" const actionMatch = /^Update\s+(.+?)\s+action\s+to\s+(v?[\w.\-+]+)/i.exec(body); - if (actionMatch && /^v?\d/.test(actionMatch[2]!)) { - return { packageName: actionMatch[1]!, to: actionMatch[2]! }; + if (actionMatch && /^v?\d/.test(actionMatch[2])) { + return { packageName: actionMatch[1], to: actionMatch[2] }; } // Generic "from A to B" anywhere. Checked before crateMatch/dockerMatch below so that a title @@ -153,19 +153,19 @@ export function extractVersionInfo(title: string): VersionInfo | null { // "from" version, not after the package name). const genericMatch = /\bfrom\s+([\w.\-+]+)\s+to\s+([\w.\-+]+)/i.exec(body); if (genericMatch) { - return { from: genericMatch[1]!, to: genericMatch[2]!, updateType: semverUpdateType(genericMatch[1]!, genericMatch[2]!) ?? undefined }; + return { from: genericMatch[1], to: genericMatch[2], updateType: semverUpdateType(genericMatch[1], genericMatch[2]) ?? undefined }; } // "Update (rust) crate X to vY" const crateMatch = /^Update\s+(?:rust\s+)?crate\s+(.+?)\s+to\s+(v?[\w.\-+]+)/i.exec(body); - if (crateMatch && /^v?\d/.test(crateMatch[2]!)) { - return { packageName: crateMatch[1]!, to: crateMatch[2]! }; + if (crateMatch && /^v?\d/.test(crateMatch[2])) { + return { packageName: crateMatch[1], to: crateMatch[2] }; } // "Update X Docker tag to vY" const dockerMatch = /^Update\s+(.+?)\s+docker\s+tag\s+to\s+(v?[\w.\-+]+)/i.exec(body); - if (dockerMatch && /^v?\d/.test(dockerMatch[2]!)) { - return { packageName: dockerMatch[1]!, to: dockerMatch[2]! }; + if (dockerMatch && /^v?\d/.test(dockerMatch[2])) { + return { packageName: dockerMatch[1], to: dockerMatch[2] }; } // Generic "Update X to vY" (last resort, single-target version only). The package-name group @@ -175,8 +175,8 @@ export function extractVersionInfo(title: string): VersionInfo | null { // bump. Real bot-generated titles for this fallback (e.g. "update renovate to v44", "update // node to v24.18.1") are single-token package names and are unaffected. const singleTargetMatch = /^Update\s+(\S+)\s+to\s+(v?[\w.\-+]+)$/i.exec(body); - if (singleTargetMatch && /^v?\d/.test(singleTargetMatch[2]!)) { - return { packageName: singleTargetMatch[1]!, to: singleTargetMatch[2]! }; + if (singleTargetMatch && /^v?\d/.test(singleTargetMatch[2])) { + return { packageName: singleTargetMatch[1], to: singleTargetMatch[2] }; } return null; diff --git a/src/app/lib/jira-utils.ts b/src/app/lib/jira-utils.ts index 25c953fb..4e47d32c 100644 --- a/src/app/lib/jira-utils.ts +++ b/src/app/lib/jira-utils.ts @@ -1,7 +1,7 @@ import { DEFAULT_FIELDS, JiraClient, JiraProxyClient, type IJiraClient } from "../services/jira-client"; import { jiraAuth, ensureJiraTokenValid } from "../stores/auth"; -const VALID_FIELD_ID = /^[a-zA-Z0-9_\-]+$/; +const VALID_FIELD_ID = /^[a-zA-Z0-9_-]+$/; export function mergeCustomFields(customFields: Array<{ id: string }>): string[] { const ids = customFields.map((f) => f.id).filter((id) => VALID_FIELD_ID.test(id)); diff --git a/src/app/lib/settings-transfer.ts b/src/app/lib/settings-transfer.ts index 90afb275..f9d739f8 100644 --- a/src/app/lib/settings-transfer.ts +++ b/src/app/lib/settings-transfer.ts @@ -128,8 +128,8 @@ function buildViewPreferencesSection(viewState: ViewState): Record { - const snapshot = JSON.parse(JSON.stringify(config)) as Record; +export function buildExportPayload(currentConfig: Config, viewState: ViewState): Record { + const snapshot = JSON.parse(JSON.stringify(currentConfig)) as Record; for (const [parentKey, childKeys] of Object.entries(EXPORT_DENYLIST)) { const parent = snapshot[parentKey]; if (parent && typeof parent === "object") { @@ -214,10 +214,10 @@ export function parseImportFile(rawText: string): ParseImportResult { } // (e) post-parse migrations (stale-defaultTab cleanup) - const config = postParseConfigFixups(result.data); + const parsedConfig = postParseConfigFixups(result.data); // (f) success — rawJson is the parsed original, retained for _credentials/_viewPreferences inspection - return { ok: true, config, rawJson }; + return { ok: true, config: parsedConfig, rawJson }; } // ── Client-side envelope encryption ───────────────────────────────── @@ -810,10 +810,10 @@ export async function commitImportedSettings( * the user is always already authenticated, so that flow always confirms and * never consults this helper. */ -export function hasExistingLocalConfig(config: Config): boolean { +export function hasExistingLocalConfig(localConfig: Config): boolean { return ( - config.onboardingComplete === true || - config.selectedRepos.length > 0 || - config.selectedOrgs.length > 0 + localConfig.onboardingComplete || + localConfig.selectedRepos.length > 0 || + localConfig.selectedOrgs.length > 0 ); } diff --git a/src/app/lib/use-credential-import.ts b/src/app/lib/use-credential-import.ts index b971428e..3c6c272f 100644 --- a/src/app/lib/use-credential-import.ts +++ b/src/app/lib/use-credential-import.ts @@ -57,8 +57,8 @@ export function createCredentialImport(opts: CreateCredentialImportOptions) { const [terminalError, setTerminalError] = createSignal(null); const [resolvedCred, setResolvedCred] = createSignal(null); - // Generation counter tying an in-flight unseal/resolve to the file that started - // it (mirrors auth.ts's _crossTabFetchGen). Bumped on every reset and on every + // Generation counter tying an in-flight unseal/resolve to the file that started it + // (mirrors auth.ts's _crossTabFetchGen). Bumped on every reset and on every // new file selection; handleCodeSubmit captures it before each await and bails // if it changed, so a Cancel-then-reselect during the multi-second // unseal/resolve window can't strand one file's ciphertext/credential into a diff --git a/src/app/pages/LoginPage.tsx b/src/app/pages/LoginPage.tsx index 52a9ab58..efc4c55e 100644 --- a/src/app/pages/LoginPage.tsx +++ b/src/app/pages/LoginPage.tsx @@ -25,9 +25,11 @@ export default function LoginPage() { console.warn("[app] Dashboard chunk prefetch failed"); }); }; - "requestIdleCallback" in window - ? requestIdleCallback(prefetch) - : setTimeout(prefetch, 2000); + if ("requestIdleCallback" in window) { + requestIdleCallback(prefetch); + } else { + setTimeout(prefetch, 2000); + } }); const [showPatForm, setShowPatForm] = createSignal(false); diff --git a/src/app/services/api-usage.ts b/src/app/services/api-usage.ts index 11c8a84a..44e42f51 100644 --- a/src/app/services/api-usage.ts +++ b/src/app/services/api-usage.ts @@ -170,7 +170,7 @@ export function trackApiCall(source: ApiCallSource, pool: ApiPool, count = 1): v export function getUsageSnapshot(): ApiCallRecord[] { // Read _version() first to establish reactive dependency _version(); - return Object.values(_usageData.records).sort((a, b) => { + return Object.values(_usageData.records).toSorted((a, b) => { if (b.count !== a.count) return b.count - a.count; return b.lastCalledAt - a.lastCalledAt; }); diff --git a/src/app/services/api.ts b/src/app/services/api.ts index b917bf57..6b495f58 100644 --- a/src/app/services/api.ts +++ b/src/app/services/api.ts @@ -110,6 +110,7 @@ function extractRejectionError(reason: unknown): { statusCode: number | null; me * Extracts partial data from a GraphqlResponseError for search queries. * Only matches responses containing a `search` key (issues/PRs search shape). */ +// oxlint-disable-next-line typescript/no-unnecessary-type-parameters function extractSearchPartialData(err: unknown): T | null { if ( err && @@ -143,7 +144,7 @@ export async function pooledAllSettled( tasks: (() => Promise)[], concurrency: number ): Promise[]> { - const results: PromiseSettledResult[] = new Array(tasks.length); + const results = Array.from>({ length: tasks.length }); let nextIndex = 0; async function runWorker(): Promise { @@ -546,6 +547,7 @@ interface SearchPageResult { * caller-provided `processNode` callback. Handles partial errors, cap enforcement, * and rate limit tracking. Returns the count of items added by processNode. */ +// oxlint-disable-next-line typescript/no-unnecessary-type-parameters async function paginateGraphQLSearch; rateLimit?: GraphQLRateLimit }, TNode>( octokit: GitHubOctokit, query: string, @@ -708,7 +710,7 @@ async function runForkPRFallback( try { const forkResponse = await octokit.graphql(forkQuery, { ...variables, request: { apiSource: "forkCheck" } }); if (forkResponse.rateLimit) { - updateGraphqlRateLimit(forkResponse.rateLimit as GraphQLRateLimit); + updateGraphqlRateLimit(forkResponse.rateLimit); } for (let i = 0; i < forkChunk.length; i++) { @@ -1247,6 +1249,7 @@ export interface NodeBodiesFetchResult { * out contribute their requested ids to `failedIds` so callers can avoid * retrying a persistently-failing id on every poll cycle. */ +// oxlint-disable-next-line typescript/no-unnecessary-type-parameters async function fetchNodeBodiesBatched( octokit: GitHubOctokit, nodeIds: string[], @@ -1429,7 +1432,7 @@ function mergeEnrichment( const viewerReviewRequested = e.viewerLatestReviewState === "APPROVED" && !e.viewerReviewRequested ? false - : Boolean(pr.viewerReviewRequested || e.viewerReviewRequested); + : (pr.viewerReviewRequested ?? false) || e.viewerReviewRequested; const reviewerLogins = viewerLogin && (viewerReviewRequested || e.viewerLatestReviewState !== null) && @@ -1639,7 +1642,7 @@ export async function fetchIssuesAndPullRequests( // Merge tracked user results and collect new (delta) node IDs for both // monitored repo PRs (added above) and tracked user PRs (added below). if (trackedSearchTasks.length > 0) { - const settled = trackedResults as PromiseSettledResult[]; + const settled = trackedResults; for (let i = 0; i < settled.length; i++) { const result = settled[i]; const trackedLogin = trackedSearchTasks[i].login; @@ -1939,7 +1942,7 @@ export async function fetchWorkflowRuns( workflowEntries.sort((a, b) => a.latestAt > b.latestAt ? -1 : a.latestAt < b.latestAt ? 1 : 0); // Take most recent M runs per workflow for (const { runs: workflowRuns } of workflowEntries.slice(0, maxWorkflows)) { - const sorted = workflowRuns.sort( + const sorted = workflowRuns.toSorted( (a, b) => a.created_at > b.created_at ? -1 : a.created_at < b.created_at ? 1 : 0 ); for (const run of sorted.slice(0, maxRuns)) { diff --git a/src/app/services/github.ts b/src/app/services/github.ts index b185e58f..17db8f21 100644 --- a/src/app/services/github.ts +++ b/src/app/services/github.ts @@ -148,9 +148,9 @@ export function onApiRequest(cb: (info: ApiRequestInfo) => void): void { // ── Client factory ─────────────────────────────────────────────────────────── -export function createGitHubClient(token: string): GitHubOctokitInstance { +export function createGitHubClient(authToken: string): GitHubOctokitInstance { const client = new GitHubOctokit({ - auth: token, + auth: authToken, userAgent: "github-tracker", throttle: { onRateLimit: ( @@ -234,7 +234,7 @@ export function createGitHubClient(token: string): GitHubOctokitInstance { }; for (const cb of _requestCallbacks) { try { cb(info); } catch { /* swallow */ } } } - const errHeaders = errResponse?.headers as Record | undefined; + const errHeaders = errResponse?.headers; if (errHeaders) { try { if (isGraphql) { diff --git a/src/app/services/jira-client.ts b/src/app/services/jira-client.ts index 37646295..25f1a5e9 100644 --- a/src/app/services/jira-client.ts +++ b/src/app/services/jira-client.ts @@ -54,7 +54,7 @@ export class JiraClient implements IJiraClient { "Authorization": `Bearer ${accessToken}`, "Accept": "application/json", "Content-Type": "application/json", - ...(init.headers ?? {}), + ...(init.headers as Record | undefined), }, }); diff --git a/src/app/services/poll.ts b/src/app/services/poll.ts index cfb33dbf..73fac790 100644 --- a/src/app/services/poll.ts +++ b/src/app/services/poll.ts @@ -120,7 +120,7 @@ createRoot(() => { }); createEffect(() => { - const key = (config.trackedUsers ?? []).map((u) => u.login).sort().join(","); + const key = (config.trackedUsers ?? []).map((u) => u.login).toSorted().join(","); if (!_trackedUsersMounted) { _trackedUsersMounted = true; _trackedUsersKey = key; @@ -136,7 +136,7 @@ createRoot(() => { }); createEffect(() => { - const key = (config.monitoredRepos ?? []).map((r) => r.fullName).sort().join(","); + const key = (config.monitoredRepos ?? []).map((r) => r.fullName).toSorted().join(","); if (!_monitoredReposMounted) { _monitoredReposMounted = true; _monitoredReposKey = key; diff --git a/src/app/stores/auth.ts b/src/app/stores/auth.ts index 6054ea9f..3ec98f39 100644 --- a/src/app/stores/auth.ts +++ b/src/app/stores/auth.ts @@ -72,7 +72,7 @@ const [_jiraAuth, _setJiraAuth] = createSignal( localStorage.removeItem?.(JIRA_AUTH_STORAGE_KEY); return null; } - return result.data as JiraAuthState; + return result.data; } catch { return null; } @@ -201,7 +201,7 @@ export function setAuth(response: TokenExchangeResponse): void { console.info("[auth] access token set"); } -export function setAuthFromPat(token: string, userData: GitHubUser): void { +export function setAuthFromPat(patToken: string, userData: GitHubUser): void { const previousLogin = user()?.login; const isIdentitySwitch = previousLogin !== undefined && previousLogin.toLowerCase() !== userData.login.toLowerCase(); @@ -231,7 +231,7 @@ export function setAuthFromPat(token: string, userData: GitHubUser): void { void clearIdentityData(); } - setAuth({ access_token: token }); + setAuth({ access_token: patToken }); setUser({ login: userData.login, avatar_url: userData.avatar_url, name: userData.name }); updateConfig({ authMethod: "pat" }); } @@ -262,8 +262,8 @@ export async function clearIdentityData(): Promise { for (const cb of _onClearCallbacks) { try { cb(); } catch (e) { console.warn("[auth] onAuthCleared callback threw during identity data clear:", e); } } - // IndexedDB cache clear — AWAITED so callers can sequence work strictly after - // it (prevents a new identity rendering the previous identity's cached data). + // IndexedDB cache clear — AWAITED so callers can sequence work strictly after it + // (prevents a new identity rendering the previous identity's cached data). try { await clearCache(); } catch (err) { diff --git a/src/app/stores/cache.ts b/src/app/stores/cache.ts index d7e1bd83..481ada0c 100644 --- a/src/app/stores/cache.ts +++ b/src/app/stores/cache.ts @@ -69,9 +69,9 @@ export async function setCacheEntry( try { const db = await getDb(); await db.put("cache", entry); - } catch (err) { + } catch (retryErr) { console.warn("[cache] Still over quota after emergency eviction — entry dropped"); - Sentry.captureException(err, { tags: { source: "cache-eviction-retry" } }); + Sentry.captureException(retryErr, { tags: { source: "cache-eviction-retry" } }); } } else { throw err; diff --git a/src/app/stores/view.ts b/src/app/stores/view.ts index ed495597..a5d168af 100644 --- a/src/app/stores/view.ts +++ b/src/app/stores/view.ts @@ -81,7 +81,7 @@ export type DependencyFilterField = keyof DependencyFilters; // "done" intentionally excluded — JQL `statusCategory != Done` never returns Done items export const JiraFiltersSchema = z.object({ - scope: z.enum(["assigned", "reported", "watching"]).or(z.string().regex(/^[a-zA-Z0-9_\-]+$/).max(100)).default("assigned"), + scope: z.enum(["assigned", "reported", "watching"]).or(z.string().regex(/^[a-zA-Z0-9_-]+$/).max(100)).default("assigned"), statusCategory: z.enum(["all", "new", "indeterminate"]).default("all"), priority: z.enum(["all", "Highest", "High", "Medium", "Low", "Lowest"]).default("all"), sortField: z.string().default(JIRA_CUSTOM_SORT_FIELD), @@ -242,7 +242,8 @@ function coerceStrippedItemsArray(raw: unknown): unknown { * means validation failed. */ function validateViewStateField(key: K, value: unknown): ViewState[K] | undefined { - const result = ViewStateSchema.pick({ [key]: true } as Partial>).safeParse({ + const mask: Partial> = { [key]: true }; + const result = ViewStateSchema.pick(mask).safeParse({ [key]: value, }); return result.success ? ((result.data as Record)[key] as ViewState[K]) : undefined; diff --git a/src/shared/schemas.ts b/src/shared/schemas.ts index 22e3f13c..e1b3be23 100644 --- a/src/shared/schemas.ts +++ b/src/shared/schemas.ts @@ -62,7 +62,7 @@ export function isTabUnscoped(tab: Pick): b export const JiraAuthMethodSchema = z.enum(["oauth", "token"]).default("oauth"); export const JiraCustomFieldSchema = z.object({ - id: z.string().regex(/^[a-zA-Z0-9_\-]+$/).max(100), + id: z.string().regex(/^[a-zA-Z0-9_-]+$/).max(100), name: z.string().max(200), }); diff --git a/src/worker/index.ts b/src/worker/index.ts index b5413158..695960e4 100644 --- a/src/worker/index.ts +++ b/src/worker/index.ts @@ -511,7 +511,7 @@ function parseSentryDsn(dsn: string): ParsedDsn | null { if (!dsn) return null; try { const url = new URL(dsn); - const projectId = url.pathname.split("/").filter(Boolean).pop() ?? ""; + const projectId = url.pathname.split("/").findLast(Boolean) ?? ""; if (!url.hostname || !projectId || !url.username) return null; return { host: url.hostname, projectId, publicKey: url.username }; } catch { @@ -1067,8 +1067,8 @@ async function handleJiraTokenExchange( return errorResponse("jira_token_exchange_failed", 400, cors); } - const refreshToken = atlassianData["refresh_token"] as string; - const accessToken = atlassianData["access_token"] as string; + const refreshToken = atlassianData["refresh_token"]; + const accessToken = atlassianData["access_token"]; const expiresIn = atlassianData["expires_in"] ?? 3600; let sealedRefreshToken: string; @@ -1182,8 +1182,8 @@ async function handleJiraTokenRefresh( return errorResponse("jira_refresh_failed", 400, cors); } - const newRefreshToken = atlassianData["refresh_token"] as string; - const newAccessToken = atlassianData["access_token"] as string; + const newRefreshToken = atlassianData["refresh_token"]; + const newAccessToken = atlassianData["access_token"]; const expiresIn = atlassianData["expires_in"] ?? 3600; let newSealedRefreshToken: string; @@ -1430,7 +1430,7 @@ async function handleJiraProxy( // GET with params as query string — only allowlisted keys forwarded const searchParams = new URLSearchParams(); if (params && typeof params === "object") { - for (const [k, v] of Object.entries(params as Record)) { + for (const [k, v] of Object.entries(params as Record)) { if (ALLOWED_SEARCH_PARAMS.has(k) && v !== undefined && v !== null) searchParams.set(k, Array.isArray(v) ? v.join(",") : String(v)); } diff --git a/src/worker/sentry.ts b/src/worker/sentry.ts index 3fca61b6..3ee89421 100644 --- a/src/worker/sentry.ts +++ b/src/worker/sentry.ts @@ -5,7 +5,7 @@ import { requestDataIntegration, type CloudflareOptions } from "@sentry/cloudfla interface WorkerSentryEvent { request?: { url?: string; - query_string?: string | unknown; + query_string?: unknown; headers?: unknown; cookies?: unknown; data?: unknown; diff --git a/tests/acceptance/steps/dependency-exclusions.steps.tsx b/tests/acceptance/steps/dependency-exclusions.steps.tsx index 8936c122..48020398 100644 --- a/tests/acceptance/steps/dependency-exclusions.steps.tsx +++ b/tests/acceptance/steps/dependency-exclusions.steps.tsx @@ -457,12 +457,12 @@ describeFeature(feature, ({ Scenario, Background, BeforeEachScenario, AfterEachS issues: [], pullRequests: [ depBotPR({ - repoFullName: REPOS[0]!.fullName, + repoFullName: REPOS[0].fullName, title: "Bump lodash from 4.1 to 4.2", headRef: "dependabot/npm_and_yarn/lodash-4.2", }), depBotPR({ - repoFullName: REPOS[1]!.fullName, + repoFullName: REPOS[1].fullName, title: "Bump axios from 0.27 to 1.0", headRef: "dependabot/npm_and_yarn/axios-1.0.0", }), diff --git a/tests/acceptance/steps/org-order-stability.steps.tsx b/tests/acceptance/steps/org-order-stability.steps.tsx index 155308cd..f83110ce 100644 --- a/tests/acceptance/steps/org-order-stability.steps.tsx +++ b/tests/acceptance/steps/org-order-stability.steps.tsx @@ -70,14 +70,14 @@ function makeOrgRepos(org: string): RepoEntry[] { function getOrgHeaderOrder(orgNames: string[]): string[] { const escaped = orgNames.map((n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")); const pattern = new RegExp(`^(${escaped.join("|")})$`); - return screen.getAllByText(pattern).map((el) => el.textContent!); + return screen.getAllByText(pattern).map((el) => el.textContent); } // ── Helper: accordion (6+ orgs) org header order ───────────────────────────── function getAccordionOrder(orgNames: string[]): string[] { return orgNames .map((name) => ({ name, btn: screen.getByRole("button", { name: new RegExp(name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")) }) })) - .sort((a, b) => { + .toSorted((a, b) => { const pos = a.btn.compareDocumentPosition(b.btn); return pos & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1; }) @@ -116,7 +116,7 @@ describeFeature(feature, ({ Scenario, Background, BeforeEachScenario, AfterEachS async () => { vi.mocked(api.fetchRepos).mockImplementation((_client, org) => { if (org === "beta-org") return Promise.reject(new Error("beta load failed")); - return Promise.resolve(makeOrgRepos(org as string)); + return Promise.resolve(makeOrgRepos(org)); }); render(() => ( @@ -140,7 +140,7 @@ describeFeature(feature, ({ Scenario, Background, BeforeEachScenario, AfterEachS 'the user clicks the Retry button on "beta-org" and the repos load successfully', async () => { vi.mocked(api.fetchRepos).mockImplementation((_client, org) => - Promise.resolve(makeOrgRepos(org as string)) + Promise.resolve(makeOrgRepos(org)) ); fireEvent.click(screen.getByText("Retry")); @@ -165,7 +165,7 @@ describeFeature(feature, ({ Scenario, Background, BeforeEachScenario, AfterEachS 'the RepoSelector displays 3 orgs sorted as "alice", "acme-corp", "beta-org" with all repos loaded', async () => { vi.mocked(api.fetchRepos).mockImplementation((_client, org) => - Promise.resolve(makeOrgRepos(org as string)) + Promise.resolve(makeOrgRepos(org)) ); render(() => ( @@ -209,7 +209,7 @@ describeFeature(feature, ({ Scenario, Background, BeforeEachScenario, AfterEachS 'the RepoSelector displays 2 orgs sorted as "alice", "delta-inc" with order frozen', async () => { vi.mocked(api.fetchRepos).mockImplementation((_client, org) => - Promise.resolve(makeOrgRepos(org as string)) + Promise.resolve(makeOrgRepos(org)) ); const { createSignal } = await import("solid-js"); @@ -260,7 +260,7 @@ describeFeature(feature, ({ Scenario, Background, BeforeEachScenario, AfterEachS 'the RepoSelector is displayed with 4 orgs "charlie", "acme-corp", "beta-org", "delta-inc" where "charlie" is the personal org', async () => { vi.mocked(api.fetchRepos).mockImplementation((_client, org) => - Promise.resolve(makeOrgRepos(org as string)) + Promise.resolve(makeOrgRepos(org)) ); // charlie has type "user" — sort puts it first (personal org) @@ -306,7 +306,7 @@ describeFeature(feature, ({ Scenario, Background, BeforeEachScenario, AfterEachS async () => { vi.mocked(api.fetchRepos).mockImplementation((_client, org) => { if (org === "echo-labs") return Promise.reject(new Error("echo load failed")); - return Promise.resolve(makeOrgRepos(org as string)); + return Promise.resolve(makeOrgRepos(org)); }); const sevenEntries = sevenOrgs.map((login) => ({ @@ -342,7 +342,7 @@ describeFeature(feature, ({ Scenario, Background, BeforeEachScenario, AfterEachS 'the user clicks Retry on "echo-labs" and its repos load successfully', async () => { vi.mocked(api.fetchRepos).mockImplementation((_client, org) => - Promise.resolve(makeOrgRepos(org as string)) + Promise.resolve(makeOrgRepos(org)) ); fireEvent.click(screen.getByText("Retry")); @@ -378,7 +378,7 @@ describeFeature(feature, ({ Scenario, Background, BeforeEachScenario, AfterEachS 'the RepoSelector displays 6 orgs all loaded and sorted with "alice" as the personal org', async () => { vi.mocked(api.fetchRepos).mockImplementation((_client, org) => - Promise.resolve(makeOrgRepos(org as string)) + Promise.resolve(makeOrgRepos(org)) ); const startEntries = startOrgs.map((login) => ({ @@ -464,7 +464,7 @@ describeFeature(feature, ({ Scenario, Background, BeforeEachScenario, AfterEachS 'the RepoSelector displays 3 orgs sorted as "alice", "acme-corp", "delta-inc" with order frozen', async () => { vi.mocked(api.fetchRepos).mockImplementation((_client, org) => - Promise.resolve(makeOrgRepos(org as string)) + Promise.resolve(makeOrgRepos(org)) ); const { createSignal } = await import("solid-js"); diff --git a/tests/app/lib/proxy.test.ts b/tests/app/lib/proxy.test.ts index 68933735..a9530fcc 100644 --- a/tests/app/lib/proxy.test.ts +++ b/tests/app/lib/proxy.test.ts @@ -197,7 +197,7 @@ describe("acquireTurnstileToken", () => { it("throws immediately when siteKey is undefined-like empty", async () => { await expect( - mod.acquireTurnstileToken("" as string, "seal"), + mod.acquireTurnstileToken("", "seal"), ).rejects.toThrow("VITE_TURNSTILE_SITE_KEY not configured"); }); @@ -219,7 +219,7 @@ describe("acquireTurnstileToken", () => { set(fn: () => void) { if (originalSet) originalSet.call(this, fn); // Schedule onload after current microtask - Promise.resolve().then(() => fn?.()); + void Promise.resolve().then(() => fn?.()); }, get() { return null; }, configurable: true, diff --git a/tests/components/DashboardPage.test.tsx b/tests/components/DashboardPage.test.tsx index ddad4387..a540614c 100644 --- a/tests/components/DashboardPage.test.tsx +++ b/tests/components/DashboardPage.test.tsx @@ -2566,7 +2566,6 @@ describe("DashboardPage — dependency exclusions", () => { errors: [], }); - const githubService = await import("../../src/app/services/github"); const graphqlSpy = vi.fn().mockResolvedValue({ nodes: [], rateLimit: null }); vi.mocked(githubService.getClient).mockReturnValue({ graphql: graphqlSpy } as unknown as ReturnType); @@ -2608,7 +2607,6 @@ describe("DashboardPage — dependency exclusions", () => { errors: [], }); - const githubService = await import("../../src/app/services/github"); const graphqlSpy = vi.fn().mockResolvedValue({ nodes: [{ databaseId: 100, body: RENOVATE_BODY }], rateLimit: null, @@ -2896,7 +2894,6 @@ describe("DashboardPage — depBodies fetch guard recovers from a hung GraphQL r it("releases the _fetchingDepBodies guard after the GraphQL timeout fires, so a later poll cycle retries the fetch", async () => { vi.useFakeTimers(); try { - const githubService = await import("../../src/app/services/github"); // Never resolves — reproduces a hung GraphQL request: without // raceWithTimeout, awaiting this promise would never settle, and // the effect's finally block (which releases _fetchingDepBodies) would @@ -2974,7 +2971,6 @@ describe("DashboardPage — depBodies fetch guard recovers from a hung GraphQL r // unrelated real timers/intervals along the way. vi.useFakeTimers({ toFake: ["Date"] }); try { - const githubService = await import("../../src/app/services/github"); const graphqlSpy = vi.fn() .mockRejectedValueOnce(new Error("boom")) .mockResolvedValue({ nodes: [{ databaseId: 100, body: "not a renovate table" }], rateLimit: null }); @@ -3041,7 +3037,6 @@ describe("DashboardPage — depBodies fetch guard recovers from a hung GraphQL r }); it("prunes a stale cooldown entry when its PR leaves the dependency set, so a later reappearance is retried immediately", async () => { - const githubService = await import("../../src/app/services/github"); const graphqlSpy = vi.fn() .mockRejectedValueOnce(new Error("boom")) .mockResolvedValue({ nodes: [], rateLimit: null }); @@ -3115,7 +3110,6 @@ describe("DashboardPage — depBodies fetch guard recovers from a hung GraphQL r // evaluation, not only when toFetch is non-empty — otherwise a PR that // fails, disappears, and reopens with nothing else needing a fetch in // between would stay incorrectly excluded on a stale cooldown entry. - const githubService = await import("../../src/app/services/github"); const graphqlSpy = vi.fn() .mockRejectedValueOnce(new Error("boom")) .mockResolvedValue({ nodes: [], rateLimit: null }); @@ -3727,7 +3721,7 @@ describe("DashboardPage — PR approval integration", () => { }); await user.click(screen.getByText("owner/repo")); - const approveBtn = await waitFor(() => screen.getByLabelText("Approve #42 Fix race condition") as HTMLButtonElement); + const approveBtn = await waitFor(() => screen.getByLabelText("Approve #42 Fix race condition")); await user.click(approveBtn); await user.click(approveBtn); @@ -4691,7 +4685,7 @@ describe("DashboardPage — Mark PR ready integration", () => { await waitFor(() => screen.getByText("owner/repo")); await user.click(screen.getByText("owner/repo")); - const draftBtn = await waitFor(() => screen.getByLabelText("Mark #77 Ship draft feature ready for review") as HTMLButtonElement); + const draftBtn = await waitFor(() => screen.getByLabelText("Mark #77 Ship draft feature ready for review")); await user.click(draftBtn); await user.click(draftBtn); diff --git a/tests/components/LoginPage.test.tsx b/tests/components/LoginPage.test.tsx index 6d9b3d5b..42a91e1a 100644 --- a/tests/components/LoginPage.test.tsx +++ b/tests/components/LoginPage.test.tsx @@ -459,7 +459,7 @@ describe("LoginPage — Import from backup", () => { await openImport(user); fireFileChange(); await waitFor(() => screen.getByLabelText("One-time code")); - expect((screen.getByLabelText("One-time code") as HTMLInputElement).type).toBe("password"); + expect(screen.getByLabelText("One-time code").type).toBe("password"); // No error surfaced on a clean valid-creds detection. expect(screen.queryByRole("alert")).toBeNull(); }); @@ -748,7 +748,7 @@ describe("LoginPage — Import from backup", () => { // Defer the resolve so the flow can be abandoned while it is pending. let finishResolve!: (v: { ok: true; bundle: CredentialBundle; identity: typeof IDENTITY }) => void; vi.mocked(settingsTransfer.resolveImportedCredentials).mockReturnValueOnce( - new Promise((r) => { finishResolve = r as never; }) + new Promise((r) => { finishResolve = r; }) ); vi.mocked(settingsTransfer.hasExistingLocalConfig).mockReturnValue(false); // would otherwise auto-login vi.mocked(settingsTransfer.commitImportedSettings).mockResolvedValue({ jiraRestored: true }); @@ -790,7 +790,7 @@ describe("LoginPage — Import from backup", () => { await user.click(screen.getByRole("button", { name: "Restore credentials" })); await waitFor(() => - expect((screen.getByRole("button", { name: "Cancel" }) as HTMLButtonElement).disabled).toBe(true) + expect(screen.getByRole("button", { name: "Cancel" }).disabled).toBe(true) ); resolveUnseal({ ok: true, ciphertext: "CT" }); await waitFor(() => expect(mockNavigate).toHaveBeenCalledWith("/", { replace: true })); diff --git a/tests/components/dashboard/JiraAssignedTab.test.tsx b/tests/components/dashboard/JiraAssignedTab.test.tsx index 8c40a7cc..57dddbd5 100644 --- a/tests/components/dashboard/JiraAssignedTab.test.tsx +++ b/tests/components/dashboard/JiraAssignedTab.test.tsx @@ -28,7 +28,7 @@ function bumpMockJiraFilters(next: typeof mockJiraFilters): void { } vi.mock("../../../src/app/stores/view", () => ({ - viewState: new Proxy({} as Record, { + viewState: new Proxy({}, { get(_t, key: string) { if (key === "trackedItems") return mockTrackedItems; if (key === "tabFilters") { @@ -771,8 +771,8 @@ describe("JiraAssignedTab", () => { render(() => ); // Initial: PROJ-1 first (up disabled), PROJ-3 last (down disabled). - expect((screen.getByRole("button", { name: "Move up: PROJ-1" }) as HTMLButtonElement).disabled).toBe(true); - expect((screen.getByRole("button", { name: "Move down: PROJ-3" }) as HTMLButtonElement).disabled).toBe(true); + expect(screen.getByRole("button", { name: "Move up: PROJ-1" }).disabled).toBe(true); + expect(screen.getByRole("button", { name: "Move down: PROJ-3" }).disabled).toBe(true); // Move PROJ-1 to the bottom; poke the signal (same object refs) to force // filtered → filteredSorted → customPageItems → to re-evaluate. @@ -782,10 +782,10 @@ describe("JiraAssignedTab", () => { // New first row (PROJ-2): up disabled. Moved-to-last row (PROJ-1): up now // enabled, down now disabled. Former-last row (PROJ-3): down now enabled. // Pre-fix, every one of these was frozen at its first-render value. - expect((screen.getByRole("button", { name: "Move up: PROJ-2" }) as HTMLButtonElement).disabled).toBe(true); - expect((screen.getByRole("button", { name: "Move up: PROJ-1" }) as HTMLButtonElement).disabled).toBe(false); - expect((screen.getByRole("button", { name: "Move down: PROJ-1" }) as HTMLButtonElement).disabled).toBe(true); - expect((screen.getByRole("button", { name: "Move down: PROJ-3" }) as HTMLButtonElement).disabled).toBe(false); + expect(screen.getByRole("button", { name: "Move up: PROJ-2" }).disabled).toBe(true); + expect(screen.getByRole("button", { name: "Move up: PROJ-1" }).disabled).toBe(false); + expect(screen.getByRole("button", { name: "Move down: PROJ-1" }).disabled).toBe(true); + expect(screen.getByRole("button", { name: "Move down: PROJ-3" }).disabled).toBe(false); }); it("disables arrow buttons when a status filter is active", () => { @@ -889,7 +889,7 @@ describe("JiraAssignedTab", () => { let rectCallCount = 0; vi.spyOn(Element.prototype, "getBoundingClientRect").mockImplementation(() => { rectCallCount += 1; - return { top: rectCallCount * 10, left: 0, right: 0, bottom: 0, width: 0, height: 0, x: 0, y: 0, toJSON: () => ({}) } as DOMRect; + return { top: rectCallCount * 10, left: 0, right: 0, bottom: 0, width: 0, height: 0, x: 0, y: 0, toJSON: () => ({}) }; }); vi.spyOn(window, "requestAnimationFrame").mockImplementation((cb) => { cb(0); return 0; }); const animateSpy = vi.fn(); diff --git a/tests/components/onboarding/RepoSelector.test.tsx b/tests/components/onboarding/RepoSelector.test.tsx index 8ec0c795..a4cf1e94 100644 --- a/tests/components/onboarding/RepoSelector.test.tsx +++ b/tests/components/onboarding/RepoSelector.test.tsx @@ -243,7 +243,7 @@ describe("RepoSelector", () => { ]); vi.mocked(api.fetchRepos).mockImplementation((_client, org) => { return Promise.resolve([ - { owner: org as string, name: "repo", fullName: `${org}/repo`, pushedAt: "2026-03-20T00:00:00Z" }, + { owner: org, name: "repo", fullName: `${org}/repo`, pushedAt: "2026-03-20T00:00:00Z" }, ]); }); render(() => ( @@ -745,7 +745,7 @@ describe("RepoSelector — upstream discovery", () => { expect(api.discoverUpstreamRepos).toHaveBeenCalled(); }); - const excludeSet = vi.mocked(api.discoverUpstreamRepos).mock.calls[0][2] as Set; + const excludeSet = vi.mocked(api.discoverUpstreamRepos).mock.calls[0][2]; expect(excludeSet.has("myorg/repo-a")).toBe(true); }); @@ -1080,7 +1080,7 @@ describe("RepoSelector — org accordion", () => { vi.clearAllMocks(); vi.restoreAllMocks(); vi.mocked(api.fetchRepos).mockImplementation((_client, org) => - Promise.resolve(makeOrgRepos(org as string)) + Promise.resolve(makeOrgRepos(org)) ); }); @@ -1528,7 +1528,7 @@ describe("RepoSelector — org accordion", () => { const sevenOrgs = [...sixOrgs, "eta-org"]; const sevenOrgEntries = sevenOrgs.map((login) => ({ login, avatarUrl: "", type: "org" as const })); vi.mocked(api.fetchRepos).mockImplementation((_client, org) => - Promise.resolve(makeOrgRepos(org as string)) + Promise.resolve(makeOrgRepos(org)) ); setSelectedOrgs(sevenOrgs); @@ -1630,7 +1630,7 @@ describe("RepoSelector — org accordion", () => { vi.mocked(api.fetchRepos).mockImplementation((_client, org) => { if (org === "zeta-org") return zetaPending; - return Promise.resolve(makeOrgRepos(org as string)); + return Promise.resolve(makeOrgRepos(org)); }); render(() => ( @@ -1672,7 +1672,7 @@ describe("RepoSelector — org accordion", () => { it("expanding a failed accordion org panel shows Retry button and allows re-fetch", async () => { vi.mocked(api.fetchRepos).mockImplementation((_client, org) => { if (org === "zeta-org") return Promise.reject(new Error("zeta load failed")); - return Promise.resolve(makeOrgRepos(org as string)); + return Promise.resolve(makeOrgRepos(org)); }); render(() => ( @@ -1700,7 +1700,7 @@ describe("RepoSelector — org accordion", () => { // Set up the retry to succeed vi.mocked(api.fetchRepos).mockImplementation((_client, org) => { - return Promise.resolve(makeOrgRepos(org as string)); + return Promise.resolve(makeOrgRepos(org)); }); fireEvent.click(screen.getByText("Retry")); @@ -1727,14 +1727,14 @@ describe("RepoSelector — frozen org order", () => { function getOrgHeaderOrder(orgNames: string[]): string[] { const escaped = orgNames.map((n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")); const pattern = new RegExp(`^(${escaped.join("|")})$`); - return screen.getAllByText(pattern).map((el) => el.textContent!); + return screen.getAllByText(pattern).map((el) => el.textContent); } // Accordion mode: org names are inside button triggers — sort by DOM position. function getAccordionOrder(orgNames: string[]): string[] { return orgNames .map((name) => ({ name, btn: screen.getByRole("button", { name: new RegExp(name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")) }) })) - .sort((a, b) => { + .toSorted((a, b) => { const pos = a.btn.compareDocumentPosition(b.btn); return pos & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1; }) @@ -1757,7 +1757,7 @@ describe("RepoSelector — frozen org order", () => { vi.mocked(api.fetchRepos) .mockImplementation((_client, org) => { if (org === "beta-org") return Promise.reject(new Error("beta load failed")); - return Promise.resolve(makeOrgRepos(org as string)); + return Promise.resolve(makeOrgRepos(org)); }); render(() => ( @@ -1782,7 +1782,7 @@ describe("RepoSelector — frozen org order", () => { // Set up retry to succeed for all vi.mocked(api.fetchRepos).mockImplementation((_client, org) => - Promise.resolve(makeOrgRepos(org as string)) + Promise.resolve(makeOrgRepos(org)) ); fireEvent.click(screen.getByText("Retry")); @@ -1799,7 +1799,7 @@ describe("RepoSelector — frozen org order", () => { // S2: Org order remains stable when toggling a repo checkbox it("org order remains stable when toggling a repo checkbox", async () => { vi.mocked(api.fetchRepos).mockImplementation((_client, org) => - Promise.resolve(makeOrgRepos(org as string)) + Promise.resolve(makeOrgRepos(org)) ); render(() => ( @@ -1839,7 +1839,7 @@ describe("RepoSelector — frozen org order", () => { const { createSignal } = await import("solid-js"); vi.mocked(api.fetchRepos).mockImplementation((_client, org) => - Promise.resolve(makeOrgRepos(org as string)) + Promise.resolve(makeOrgRepos(org)) ); const [selectedOrgs, setSelectedOrgs] = createSignal(["alice", "delta-inc"]); @@ -1888,7 +1888,7 @@ describe("RepoSelector — frozen org order", () => { })); vi.mocked(api.fetchRepos).mockImplementation((_client, org) => - Promise.resolve(makeOrgRepos(org as string)) + Promise.resolve(makeOrgRepos(org)) ); const [selectedOrgs, setSelectedOrgs] = createSignal(startOrgs); @@ -1936,7 +1936,7 @@ describe("RepoSelector — frozen org order", () => { vi.mocked(api.fetchRepos).mockImplementation((_client, org) => { if (org === "echo-labs") return Promise.reject(new Error("echo load failed")); - return Promise.resolve(makeOrgRepos(org as string)); + return Promise.resolve(makeOrgRepos(org)); }); render(() => ( @@ -1968,7 +1968,7 @@ describe("RepoSelector — frozen org order", () => { // Set up retry to succeed vi.mocked(api.fetchRepos).mockImplementation((_client, org) => - Promise.resolve(makeOrgRepos(org as string)) + Promise.resolve(makeOrgRepos(org)) ); fireEvent.click(screen.getByText("Retry")); @@ -1994,7 +1994,7 @@ describe("RepoSelector — frozen org order", () => { const { createSignal } = await import("solid-js"); vi.mocked(api.fetchRepos).mockImplementation((_client, org) => - Promise.resolve(makeOrgRepos(org as string)) + Promise.resolve(makeOrgRepos(org)) ); const [selectedOrgs, setSelectedOrgs] = createSignal(["alice", "acme-corp", "delta-inc"]); @@ -2042,7 +2042,7 @@ describe("RepoSelector — frozen org order", () => { const { createSignal } = await import("solid-js"); vi.mocked(api.fetchRepos).mockImplementation((_client, org) => - Promise.resolve(makeOrgRepos(org as string)) + Promise.resolve(makeOrgRepos(org)) ); const [selectedOrgs, setSelectedOrgs] = createSignal(["alice", "acme-corp", "delta-inc"]); @@ -2097,7 +2097,7 @@ describe("RepoSelector — frozen org order", () => { vi.mocked(api.fetchRepos).mockImplementation((_client, org) => { if (org === "echo-labs") return echoPending; if (org === "foxtrot-io") return foxtrotPending; - return Promise.resolve(makeOrgRepos(org as string)); + return Promise.resolve(makeOrgRepos(org)); }); const [selectedOrgs, setSelectedOrgs] = createSignal(["alice", "acme-corp"]); diff --git a/tests/components/settings/JiraSection.test.tsx b/tests/components/settings/JiraSection.test.tsx index 3cea060a..786f22fc 100644 --- a/tests/components/settings/JiraSection.test.tsx +++ b/tests/components/settings/JiraSection.test.tsx @@ -199,7 +199,7 @@ function renderSettings() { function setEnv(key: string, value: string | undefined) { if (value === undefined) { - vi.stubEnv(key, undefined as unknown as string); + vi.stubEnv(key, undefined); } else { vi.stubEnv(key, value); } @@ -500,7 +500,7 @@ describe("SettingsPage Jira section — connected state", () => { }); it("shows auth method label as API Token when authMethod=token", async () => { - mockConfig = { ...mockConfig, jira: { ...mockConfig.jira!, authMethod: "token" as const } }; + mockConfig = { ...mockConfig, jira: { ...mockConfig.jira, authMethod: "token" as const } }; renderSettings(); await waitFor(() => { expect(screen.getByText("API Token")).toBeTruthy(); @@ -748,7 +748,7 @@ describe("SettingsPage Jira section — Replace API token flow & deep-linking", // Re-open to verify token input was cleared fireEvent.click(replaceBtn); - expect((screen.getByLabelText("New Atlassian API token") as HTMLInputElement).value).toBe(""); + expect(screen.getByLabelText("New Atlassian API token").value).toBe(""); unmount(); // Also verify Replace button is present when expired (isJiraAuthenticated() = false) @@ -862,7 +862,7 @@ describe("SettingsPage Jira section — Replace API token flow & deep-linking", screen.getByText("API token or email is invalid — check your credentials and try again.") ).toBeTruthy(); expect( - (screen.getByRole("button", { name: /^Replace token$/i }) as HTMLButtonElement).disabled + screen.getByRole("button", { name: /^Replace token$/i }).disabled ).toBe(false); }); expect(mockSetJiraAuth).not.toHaveBeenCalled(); @@ -947,7 +947,7 @@ describe("SettingsPage Jira section — Replace API token flow & deep-linking", fireEvent.click(screen.getByRole("button", { name: /^Replace token$/i })); await waitFor(() => { expect( - (screen.getByRole("button", { name: /^Replace token$/i }) as HTMLButtonElement).disabled + screen.getByRole("button", { name: /^Replace token$/i }).disabled ).toBe(false); }); expect(Sentry.captureException).not.toHaveBeenCalled(); diff --git a/tests/components/settings/SettingsPage.test.tsx b/tests/components/settings/SettingsPage.test.tsx index fe20b291..18daa2bb 100644 --- a/tests/components/settings/SettingsPage.test.tsx +++ b/tests/components/settings/SettingsPage.test.tsx @@ -1039,7 +1039,7 @@ describe("SettingsPage — Manage org access button", () => { updateConfig({ selectedOrgs: [] }); let resolveFetch!: (v: never[]) => void; vi.mocked(apiModule.fetchOrgs).mockReturnValue( - new Promise((r) => { resolveFetch = r as (v: never[]) => void; }) + new Promise((r) => { resolveFetch = r; }) ); renderSettings(); const btn = screen.getByRole("button", { name: "Manage org access" }); @@ -1215,7 +1215,7 @@ describe("SettingsPage — enableTracking toggle", () => { super(parts, options); if (parts) blobParts.push(...parts); } - } as typeof Blob; + }; await user.click(screen.getByRole("button", { name: "Export config only" })); globalThis.Blob = originalBlob; const json = JSON.parse(blobParts[0] as string); @@ -1352,7 +1352,7 @@ describe("SettingsPage — monitor toggle wiring", () => { super(parts, options); if (parts) blobParts.push(...parts); } - } as typeof Blob; + }; await user.click(screen.getByRole("button", { name: "Export config only" })); @@ -1978,10 +1978,10 @@ describe("SettingsPage — Data: Import with encrypted credentials", () => { // Unseal in flight — the single-use nonce must not be abandonable mid-flight. await waitFor(() => - expect((screen.getByRole("button", { name: "Cancel" }) as HTMLButtonElement).disabled).toBe(true) + expect(screen.getByRole("button", { name: "Cancel" }).disabled).toBe(true) ); - expect((screen.getByRole("button", { name: /continue without credentials/i }) as HTMLButtonElement).disabled).toBe(true); - expect((screen.getByRole("button", { name: "Checking..." }) as HTMLButtonElement).disabled).toBe(true); + expect(screen.getByRole("button", { name: /continue without credentials/i }).disabled).toBe(true); + expect(screen.getByRole("button", { name: "Checking..." }).disabled).toBe(true); resolveUnseal({ ok: true, ciphertext: "CIPHER" }); await waitFor(() => screen.getByText(/sign you in as/i)); @@ -1993,7 +1993,7 @@ describe("SettingsPage — Data: Import with encrypted credentials", () => { vi.mocked(proxyLib.unsealCredentialBundle).mockResolvedValue({ ok: true, ciphertext: "CIPHER-X" }); let finishResolveX!: (v: { ok: true; bundle: typeof BUNDLE; identity: typeof IDENTITY }) => void; vi.mocked(settingsTransfer.resolveImportedCredentials).mockReturnValueOnce( - new Promise((r) => { finishResolveX = r as never; }) + new Promise((r) => { finishResolveX = r; }) ); const user = userEvent.setup(); diff --git a/tests/components/settings/SettingsTOC.test.tsx b/tests/components/settings/SettingsTOC.test.tsx index b9ab8539..3d4f66db 100644 --- a/tests/components/settings/SettingsTOC.test.tsx +++ b/tests/components/settings/SettingsTOC.test.tsx @@ -115,7 +115,7 @@ describe("SettingsTOC — active highlighting", () => { intersectionRect: {} as DOMRect, rootBounds: null, time: 0, - } as unknown as IntersectionObserverEntry, + }, ], {} as IntersectionObserver ); @@ -140,7 +140,7 @@ describe("SettingsTOC — scroll to section", () => { vi.spyOn(window, "getComputedStyle").mockImplementation((el, pseudo?) => { const style = origGetComputedStyle(el, pseudo); if (el === targetEl) { - return { ...style, scrollMarginTop: "96px", getPropertyValue: style.getPropertyValue.bind(style) } as CSSStyleDeclaration; + return { ...style, scrollMarginTop: "96px", getPropertyValue: style.getPropertyValue.bind(style) }; } return style; }); diff --git a/tests/lib/dependency-detection.test.ts b/tests/lib/dependency-detection.test.ts index 008bf56d..0f2a18c1 100644 --- a/tests/lib/dependency-detection.test.ts +++ b/tests/lib/dependency-detection.test.ts @@ -251,8 +251,8 @@ describe("extractVersionInfo", () => { expect(title.toLowerCase()).not.toContain("docker"); expect(title.toLowerCase()).not.toContain("crate"); } - expect(extractVersionInfo(titles[0]!)).toEqual({ packageName: "renovate", to: "v44" }); - expect(extractVersionInfo(titles[1]!)).toEqual({ packageName: "node", to: "v24.18.1" }); + expect(extractVersionInfo(titles[0])).toEqual({ packageName: "renovate", to: "v44" }); + expect(extractVersionInfo(titles[1])).toEqual({ packageName: "node", to: "v24.18.1" }); }); it("does not match the generic single-target fallback when the captured target is not version-shaped", () => { diff --git a/tests/lib/pat.test.ts b/tests/lib/pat.test.ts index e76c6c47..e66b7de4 100644 --- a/tests/lib/pat.test.ts +++ b/tests/lib/pat.test.ts @@ -83,7 +83,7 @@ describe("isValidPatFormat", () => { }); it("rejects token with invalid characters", () => { - const token = "ghp_" + "abc!def" + "a".repeat(29); + const token = "ghp_abc!def" + "a".repeat(29); expect(expectInvalid(isValidPatFormat(token))).toContain("invalid characters"); }); diff --git a/tests/lib/sentry.test.ts b/tests/lib/sentry.test.ts index 04329a72..9f4f1bb1 100644 --- a/tests/lib/sentry.test.ts +++ b/tests/lib/sentry.test.ts @@ -334,7 +334,7 @@ describe("beforeBreadcrumbHandler", () => { to: "https://gh.gordoncode.dev/dashboard?state=xyz", }, }; - const result = beforeBreadcrumbHandler(breadcrumb as never); + const result = beforeBreadcrumbHandler(breadcrumb); expect(result!.data!.from).toBe( "https://gh.gordoncode.dev/cb?code=[REDACTED]", ); @@ -348,7 +348,7 @@ describe("beforeBreadcrumbHandler", () => { category: "fetch", data: { url: "https://api.github.com?access_token=ghu_tok" }, }; - const result = beforeBreadcrumbHandler(breadcrumb as never); + const result = beforeBreadcrumbHandler(breadcrumb); expect(result!.data!.url).toBe( "https://api.github.com?access_token=[REDACTED]", ); @@ -359,7 +359,7 @@ describe("beforeBreadcrumbHandler", () => { category: "xhr", data: { url: "https://api.github.com?code=abc" }, }; - const result = beforeBreadcrumbHandler(breadcrumb as never); + const result = beforeBreadcrumbHandler(breadcrumb); expect(result!.data!.url).toBe( "https://api.github.com?code=[REDACTED]", ); diff --git a/tests/lib/settings-transfer.test.ts b/tests/lib/settings-transfer.test.ts index 937391d2..26f3ab36 100644 --- a/tests/lib/settings-transfer.test.ts +++ b/tests/lib/settings-transfer.test.ts @@ -167,7 +167,7 @@ afterEach(() => { describe("settings-transfer — schema-drift guard", () => { it("ConfigSchema top-level shape matches the export snapshot", () => { - const actual = Object.keys(ConfigSchema.shape).sort(); + const actual = Object.keys(ConfigSchema.shape).toSorted(); const { added, removed } = diffKeys(actual, EXPECTED_CONFIG_KEYS); expect( added.length === 0 && removed.length === 0, @@ -179,7 +179,7 @@ describe("settings-transfer — schema-drift guard", () => { }); it("JiraConfigSchema shape matches the export snapshot", () => { - const actual = Object.keys(JiraConfigSchema.shape).sort(); + const actual = Object.keys(JiraConfigSchema.shape).toSorted(); const { added, removed } = diffKeys(actual, EXPECTED_JIRA_KEYS); expect( added.length === 0 && removed.length === 0, @@ -191,7 +191,7 @@ describe("settings-transfer — schema-drift guard", () => { }); it("ViewStateSchema top-level shape matches the _viewPreferences allowlist snapshot", () => { - const actual = Object.keys(ViewStateSchema.shape).sort(); + const actual = Object.keys(ViewStateSchema.shape).toSorted(); const { added, removed } = diffKeys(actual, EXPECTED_VIEW_STATE_KEYS); expect( added.length === 0 && removed.length === 0, @@ -203,7 +203,7 @@ describe("settings-transfer — schema-drift guard", () => { }); it("TrackedItemSchema shape matches the trackedItems export keep-list snapshot", () => { - const actual = Object.keys(TrackedItemSchema.shape).sort(); + const actual = Object.keys(TrackedItemSchema.shape).toSorted(); const { added, removed } = diffKeys(actual, EXPECTED_TRACKED_ITEM_KEYS); expect( added.length === 0 && removed.length === 0, @@ -215,7 +215,7 @@ describe("settings-transfer — schema-drift guard", () => { }); it("IgnoredItemSchema shape matches the ignoredItems export keep-list snapshot", () => { - const actual = Object.keys(IgnoredItemSchema.shape).sort(); + const actual = Object.keys(IgnoredItemSchema.shape).toSorted(); const { added, removed } = diffKeys(actual, EXPECTED_IGNORED_ITEM_KEYS); expect( added.length === 0 && removed.length === 0, @@ -275,7 +275,7 @@ describe("buildExportPayload — _viewPreferences", () => { const out = buildExportPayload(ConfigSchema.parse({}), viewState); const prefs = out._viewPreferences as Record; expect(prefs).toBeDefined(); - expect(Object.keys(prefs).sort()).toEqual([...EXPORTED_VIEW_PREF_KEYS].sort()); + expect(Object.keys(prefs).toSorted()).toEqual(EXPORTED_VIEW_PREF_KEYS.toSorted()); }); it("excludes the transient/privacy keys: lastActiveTab, globalSort, globalFilter", () => { @@ -303,7 +303,7 @@ describe("buildExportPayload — _viewPreferences", () => { const prefs = out._viewPreferences as Record; const entries = prefs.ignoredItems as Record[]; expect(entries).toHaveLength(1); - expect(Object.keys(entries[0]).sort()).toEqual(["id", "ignoredAt", "repo", "type"]); + expect(Object.keys(entries[0]).toSorted()).toEqual(["id", "ignoredAt", "repo", "type"]); expect("title" in entries[0]).toBe(false); expect(entries[0]).toMatchObject({ id: 1, type: "issue", repo: "org/repo", ignoredAt: 1000 }); }); @@ -721,7 +721,7 @@ function installTurnstileHarness(): Array> { return node; } return origAppend(node as never); - }) as typeof document.head.appendChild); + })); return renderOpts; } diff --git a/tests/lib/tabFilters.test.ts b/tests/lib/tabFilters.test.ts index 2298560d..d8eb404a 100644 --- a/tests/lib/tabFilters.test.ts +++ b/tests/lib/tabFilters.test.ts @@ -10,7 +10,7 @@ const { mockSetTabFilter, mockResetAllTabFilters, mockSetCustomTabFilter, mockRe })); const { mockViewState } = vi.hoisted(() => ({ - mockViewState: { customTabFilters: {} as Record> }, + mockViewState: { customTabFilters: {} }, })); vi.mock("../../src/app/stores/view", () => ({ diff --git a/tests/services/api-optimization.test.ts b/tests/services/api-optimization.test.ts index 09a14838..50afdf74 100644 --- a/tests/services/api-optimization.test.ts +++ b/tests/services/api-optimization.test.ts @@ -824,7 +824,7 @@ describe("Phase 1 prReviewReq -> Phase 2 mergeEnrichment team review request pre const octokit = makeTwoPhaseOctokit( async (_query, variables) => { - const prRevQ = String((variables as Record | undefined)?.prRevQ ?? ""); + const prRevQ = ((variables as Record | undefined)?.prRevQ as string | undefined) ?? ""; const isTrackedUserQuery = prRevQ.includes("review-requested:teammate"); return { issues: makeSearchResponse([]), diff --git a/tests/services/api-usage.test.ts b/tests/services/api-usage.test.ts index e74e7d49..0835493a 100644 --- a/tests/services/api-usage.test.ts +++ b/tests/services/api-usage.test.ts @@ -170,7 +170,7 @@ describe("flushUsageData / loadUsageData", () => { vi.advanceTimersByTime(600); const raw = localStorageMock.getItem("github-tracker:api-usage"); expect(raw).not.toBeNull(); - const parsed = JSON.parse(raw!); + const parsed = JSON.parse(raw); expect(parsed.records["lightSearch:graphql"]).toBeDefined(); expect(parsed.records["lightSearch:graphql"].count).toBe(1); }); @@ -242,7 +242,7 @@ describe("resetUsageData", () => { mod.trackApiCall("lightSearch", "graphql"); mod.resetUsageData(); const raw = localStorageMock.getItem("github-tracker:api-usage"); - const parsed = JSON.parse(raw!); + const parsed = JSON.parse(raw); expect(Object.keys(parsed.records)).toHaveLength(0); }); }); @@ -351,7 +351,7 @@ describe("checkAndResetIfExpired", () => { mod.checkAndResetIfExpired(); const raw = localStorageMock.getItem("github-tracker:api-usage"); - const parsed = JSON.parse(raw!); + const parsed = JSON.parse(raw); expect(parsed.resetAt).toBeNull(); }); @@ -364,7 +364,7 @@ describe("checkAndResetIfExpired", () => { // Record localStorage state before the expiry check const before = localStorageMock.getItem("github-tracker:api-usage"); - const beforeParsed = JSON.parse(before!); + const beforeParsed = JSON.parse(before); expect(beforeParsed.resetAt).not.toBeNull(); expect(Object.keys(beforeParsed.records)).toHaveLength(1); @@ -373,7 +373,7 @@ describe("checkAndResetIfExpired", () => { // After expiry: records cleared, resetAt null — written in a single pass const after = localStorageMock.getItem("github-tracker:api-usage"); - const afterParsed = JSON.parse(after!); + const afterParsed = JSON.parse(after); expect(afterParsed.resetAt).toBeNull(); expect(Object.keys(afterParsed.records)).toHaveLength(0); }); diff --git a/tests/services/api.test.ts b/tests/services/api.test.ts index 3df0a8da..31f2a155 100644 --- a/tests/services/api.test.ts +++ b/tests/services/api.test.ts @@ -989,7 +989,7 @@ describe("fetchIssuesAndPullRequests — cross-feature: monitored repo + bot tra async (_query: string, variables: unknown) => { const vars = variables as Record; // Unfiltered search for monitored repo returns monitoredIssueNode - if (vars.issueQ && typeof vars.issueQ === "string" && !String(vars.issueQ).includes("involves:")) { + if (typeof vars.issueQ === "string" && !vars.issueQ.includes("involves:")) { return { issues: { issueCount: 1, pageInfo: { hasNextPage: false, endCursor: null }, nodes: [monitoredIssueNode] }, prs: { issueCount: 0, pageInfo: { hasNextPage: false, endCursor: null }, nodes: [] }, @@ -997,7 +997,7 @@ describe("fetchIssuesAndPullRequests — cross-feature: monitored repo + bot tra }; } // Bot tracked user search on normal repos returns botIssueNode - if (vars.issueQ && String(vars.issueQ).includes("involves:dependabot")) { + if (typeof vars.issueQ === "string" && vars.issueQ.includes("involves:dependabot")) { return { issues: { issueCount: 1, pageInfo: { hasNextPage: false, endCursor: null }, nodes: [botIssueNode] }, prInvolves: { issueCount: 0, pageInfo: { hasNextPage: false, endCursor: null }, nodes: [] }, diff --git a/tests/services/events-poll.test.ts b/tests/services/events-poll.test.ts index 06caafd2..1c06b6e4 100644 --- a/tests/services/events-poll.test.ts +++ b/tests/services/events-poll.test.ts @@ -284,7 +284,7 @@ describe("seedHotSetsFromTargeted", () => { // fetchHotPRStatus should be called with the seeded node ID expect(fetchHotPRStatus).toHaveBeenCalledTimes(1); - const calledNodeIds = vi.mocked(fetchHotPRStatus).mock.calls[0][1] as string[]; + const calledNodeIds = vi.mocked(fetchHotPRStatus).mock.calls[0][1]; expect(calledNodeIds).toContain("PR_a"); }); @@ -335,7 +335,7 @@ describe("seedHotSetsFromTargeted", () => { await fetchHotData(); expect(fetchHotPRStatus).toHaveBeenCalledTimes(1); - const calledNodeIds = vi.mocked(fetchHotPRStatus).mock.calls[0][1] as string[]; + const calledNodeIds = vi.mocked(fetchHotPRStatus).mock.calls[0][1]; expect(calledNodeIds).toContain("PR_existing"); expect(calledNodeIds).toContain("PR_new"); }); diff --git a/tests/services/jira-keys.test.ts b/tests/services/jira-keys.test.ts index b32e2480..022718fc 100644 --- a/tests/services/jira-keys.test.ts +++ b/tests/services/jira-keys.test.ts @@ -282,7 +282,7 @@ describe("detectAndLookupJiraKeys", () => { ); const calls = vi.mocked(client.bulkFetch).mock.calls; - expect(calls.some((c) => (c[0] as string[]).includes("FEAT-42"))).toBe(true); + expect(calls.some((c) => (c[0]).includes("FEAT-42"))).toBe(true); }); it("deduplicates keys found in multiple items", async () => { @@ -299,7 +299,7 @@ describe("detectAndLookupJiraKeys", () => { ); // Should only call bulkFetch once with PROJ-1 (not duplicated) - const keys = vi.mocked(client.bulkFetch).mock.calls[0]?.[0] as string[]; + const keys = vi.mocked(client.bulkFetch).mock.calls[0]?.[0]; expect(keys.filter((k) => k === "PROJ-1")).toHaveLength(1); }); diff --git a/tests/setup.ts b/tests/setup.ts index 2ec2c401..53605194 100644 --- a/tests/setup.ts +++ b/tests/setup.ts @@ -50,10 +50,10 @@ globalThis.clearTimeout = ((id?: ReturnType) => { // deterministic relative to userEvent's chain without making rAF fully synchronous // (real timestamp preserved so time-based animation loops, e.g. SettingsTOC's // smooth-scroll easing, still terminate normally when a test doesn't stub rAF). -globalThis.requestAnimationFrame = ((cb: FrameRequestCallback) => { - Promise.resolve().then(() => cb(performance.now())); +globalThis.requestAnimationFrame = ((frameCallback: FrameRequestCallback) => { + void Promise.resolve().then(() => frameCallback(performance.now())); return 0; -}) as typeof requestAnimationFrame; +}); afterEach(() => { for (const id of pendingTimers) { diff --git a/tests/stores/auth.test.ts b/tests/stores/auth.test.ts index 203d32ae..c4e5e3a5 100644 --- a/tests/stores/auth.test.ts +++ b/tests/stores/auth.test.ts @@ -764,7 +764,7 @@ describe("setJiraAuth / jiraAuth signal", () => { mod.setJiraAuth(makeJiraAuth()); const stored = localStorageMock.getItem("github-tracker:jira-auth"); expect(stored).not.toBeNull(); - const parsed = JSON.parse(stored!); + const parsed = JSON.parse(stored); expect(parsed.accessToken).toBe("atl-access-tok"); expect(parsed.cloudId).toBe("cloud-abc"); }); diff --git a/tests/stores/view.test.ts b/tests/stores/view.test.ts index 625190e1..ed2d380d 100644 --- a/tests/stores/view.test.ts +++ b/tests/stores/view.test.ts @@ -322,7 +322,7 @@ describe("initViewPersistence", () => { const raw = localStorageMock.getItem(VIEW_KEY); expect(raw).not.toBeNull(); - const parsed = JSON.parse(raw!); + const parsed = JSON.parse(raw); expect(parsed.globalFilter.org).toBe("testorg"); expect(parsed.globalFilter.repo).toBe("testrepo"); dispose(); @@ -352,7 +352,7 @@ describe("initViewPersistence", () => { // Exactly one write, reflecting the latest (second) state. expect(setItemSpy).toHaveBeenCalledTimes(1); - const parsed = JSON.parse(localStorageMock.getItem(VIEW_KEY)!); + const parsed = JSON.parse(localStorageMock.getItem(VIEW_KEY)); expect(parsed.globalFilter.org).toBe("org2"); expect(parsed.globalFilter.repo).toBe("repo2"); @@ -373,7 +373,7 @@ describe("initViewPersistence", () => { await Promise.resolve(); vi.advanceTimersByTime(200); - const parsed = JSON.parse(localStorageMock.getItem(VIEW_KEY)!); + const parsed = JSON.parse(localStorageMock.getItem(VIEW_KEY)); expect(parsed.globalFilter.org).toBe("org1"); // The other tab's jiraCustomOrder write must survive — this tab never // touched that field, so its own stale in-memory copy (still []) must @@ -394,7 +394,7 @@ describe("initViewPersistence", () => { await Promise.resolve(); vi.advanceTimersByTime(200); - const parsed = JSON.parse(localStorageMock.getItem(VIEW_KEY)!); + const parsed = JSON.parse(localStorageMock.getItem(VIEW_KEY)); expect(parsed.jiraCustomOrder).toEqual(["MINE-1", "MINE-2"]); dispose(); @@ -425,7 +425,7 @@ describe("initViewPersistence", () => { await Promise.resolve(); vi.advanceTimersByTime(200); - const parsed = JSON.parse(localStorageMock.getItem(VIEW_KEY)!); + const parsed = JSON.parse(localStorageMock.getItem(VIEW_KEY)); expect(parsed.globalFilter.org).toBe("org1"); expect(parsed.maliciousInjectedField).toBeUndefined(); expect(Object.prototype.hasOwnProperty.call(parsed, "__proto__")).toBe(false); @@ -453,7 +453,7 @@ describe("initViewPersistence", () => { await Promise.resolve(); vi.advanceTimersByTime(200); - const parsed = JSON.parse(localStorageMock.getItem(VIEW_KEY)!); + const parsed = JSON.parse(localStorageMock.getItem(VIEW_KEY)); expect(parsed.globalFilter.org).toBe("org1"); // The malformed jiraCustomOrder must be dropped, not echoed back — this // tab's own (valid, empty) value fills the gap instead. @@ -468,12 +468,12 @@ describe("initViewPersistence", () => { setJiraCustomOrder(["MINE-1"]); await Promise.resolve(); vi.advanceTimersByTime(200); - expect(JSON.parse(localStorageMock.getItem(VIEW_KEY)!).jiraCustomOrder).toEqual(["MINE-1"]); + expect(JSON.parse(localStorageMock.getItem(VIEW_KEY)).jiraCustomOrder).toEqual(["MINE-1"]); // Simulate a stale/corrupted on-disk blob missing jiraCustomOrder entirely // (version skew, manual tampering) — this tab's own last-known value for // that key must survive even though it hasn't changed since baseline. - const onDisk = JSON.parse(localStorageMock.getItem(VIEW_KEY)!); + const onDisk = JSON.parse(localStorageMock.getItem(VIEW_KEY)); delete onDisk.jiraCustomOrder; localStorageMock.setItem(VIEW_KEY, JSON.stringify(onDisk)); @@ -481,7 +481,7 @@ describe("initViewPersistence", () => { await Promise.resolve(); vi.advanceTimersByTime(200); - const parsed = JSON.parse(localStorageMock.getItem(VIEW_KEY)!); + const parsed = JSON.parse(localStorageMock.getItem(VIEW_KEY)); expect(parsed.globalFilter.org).toBe("org1"); expect(parsed.jiraCustomOrder).toEqual(["MINE-1"]); @@ -499,7 +499,7 @@ describe("initViewPersistence", () => { await Promise.resolve(); expect(() => vi.advanceTimersByTime(200)).not.toThrow(); - const parsed = JSON.parse(localStorageMock.getItem(VIEW_KEY)!); + const parsed = JSON.parse(localStorageMock.getItem(VIEW_KEY)); expect(parsed.globalFilter.org).toBe("org1"); // Must be the FULL snapshot, not just the one field this test changed — // an untouched default field must also be present, ruling out a @@ -519,7 +519,7 @@ describe("initViewPersistence", () => { await Promise.resolve(); vi.advanceTimersByTime(200); - const parsed = JSON.parse(localStorageMock.getItem(VIEW_KEY)!); + const parsed = JSON.parse(localStorageMock.getItem(VIEW_KEY)); expect(parsed.globalFilter.org).toBe("org1"); expect(parsed.lastActiveTab).toBe("issues"); @@ -555,7 +555,7 @@ describe("initViewPersistence", () => { const raw = localStorageMock.getItem(VIEW_KEY); expect(raw).not.toBeNull(); - const parsed = JSON.parse(raw!); + const parsed = JSON.parse(raw); expect(parsed.globalFilter.org).toBe("unmount-org"); expect(parsed.globalFilter.repo).toBe("unmount-repo"); }); @@ -604,7 +604,7 @@ describe("initViewPersistence — genuine two-tab concurrency", () => { // B's commit runs strictly after A's (registered later, same target time), // so B's write is the one that lands last on disk. - const parsed = JSON.parse(localStorageMock.getItem(VIEW_KEY)!); + const parsed = JSON.parse(localStorageMock.getItem(VIEW_KEY)); expect(parsed.jiraCustomOrder).toEqual(["FROM-B"]); disposeA(); @@ -631,7 +631,7 @@ describe("initViewPersistence — genuine two-tab concurrency", () => { vi.advanceTimersByTime(200); - const parsed = JSON.parse(localStorageMock.getItem(VIEW_KEY)!); + const parsed = JSON.parse(localStorageMock.getItem(VIEW_KEY)); expect(parsed.jiraCustomOrder).toEqual(["FROM-A"]); disposeA(); @@ -653,7 +653,7 @@ describe("initViewPersistence — genuine two-tab concurrency", () => { tabB.setJiraCustomOrder(["FROM-B"]); await Promise.resolve(); vi.advanceTimersByTime(200); - expect(JSON.parse(localStorageMock.getItem(VIEW_KEY)!).jiraCustomOrder).toEqual(["FROM-B"]); + expect(JSON.parse(localStorageMock.getItem(VIEW_KEY)).jiraCustomOrder).toEqual(["FROM-B"]); // A, which never touched jiraCustomOrder, now changes an unrelated field. // A's own stale in-memory jiraCustomOrder ([]) must NOT overwrite B's @@ -662,7 +662,7 @@ describe("initViewPersistence — genuine two-tab concurrency", () => { await Promise.resolve(); vi.advanceTimersByTime(200); - const parsed = JSON.parse(localStorageMock.getItem(VIEW_KEY)!); + const parsed = JSON.parse(localStorageMock.getItem(VIEW_KEY)); expect(parsed.globalFilter.org).toBe("org1"); expect(parsed.jiraCustomOrder).toEqual(["FROM-B"]); @@ -837,7 +837,7 @@ describe("expandedRepos helpers", () => { const raw = localStorageMock.getItem(VIEW_KEY); expect(raw).not.toBeNull(); - const restored = ViewStateSchema.parse(JSON.parse(raw!)); + const restored = ViewStateSchema.parse(JSON.parse(raw)); expect(restored.expandedRepos.issues["myorg/myrepo"]).toBe(true); expect(restored.expandDefault.actions).toBe(true); expect(restored.expandedRepos.actions).toEqual({}); diff --git a/tests/worker/crypto.test.ts b/tests/worker/crypto.test.ts index 59bc97d4..6db3c5eb 100644 --- a/tests/worker/crypto.test.ts +++ b/tests/worker/crypto.test.ts @@ -479,7 +479,7 @@ describe("AES-256-GCM known-answer test (McGrew-Viega Test Case 14)", () => { // GCM spec Test Case 14: 256-bit zero key, 96-bit zero IV, empty plaintext, no AAD const key = await crypto.subtle.importKey( "raw", - new Uint8Array(32).buffer as ArrayBuffer, // 32 zero bytes + new Uint8Array(32).buffer, // 32 zero bytes { name: "AES-GCM" }, false, ["encrypt"] diff --git a/tests/worker/csp-report.test.ts b/tests/worker/csp-report.test.ts index 4f4af9c7..49f5e4d5 100644 --- a/tests/worker/csp-report.test.ts +++ b/tests/worker/csp-report.test.ts @@ -39,7 +39,7 @@ function makeCspRequest( return new Request("https://gh.gordoncode.dev/api/csp-report", { method, headers, - body: method !== "GET" ? body : undefined, + ...(method !== "GET" ? { body } : {}), }); } diff --git a/tests/worker/jira-oauth.test.ts b/tests/worker/jira-oauth.test.ts index f097e866..b7c52cfc 100644 --- a/tests/worker/jira-oauth.test.ts +++ b/tests/worker/jira-oauth.test.ts @@ -1059,7 +1059,7 @@ describe("POST /api/jira/proxy — Jira API proxy", () => { const [url, init] = mockFetch.mock.calls[0] as [string, RequestInit]; expect(url).toContain(`/rest/api/3/field`); expect(url).not.toContain("bulkfetch"); - expect((init as RequestInit).method ?? "GET").toBe("GET"); + expect((init).method ?? "GET").toBe("GET"); }); }); diff --git a/tests/worker/unseal.test.ts b/tests/worker/unseal.test.ts index 80d594c9..e2ab8541 100644 --- a/tests/worker/unseal.test.ts +++ b/tests/worker/unseal.test.ts @@ -121,7 +121,7 @@ async function sealViaEndpoint(env: Env, token: string, purpose = "credential-ex if (typeof json["sealed"] !== "string") { throw new Error(`seal failed (status ${res.status}): ${JSON.stringify(json)}`); } - return json["sealed"] as string; + return json["sealed"]; } /** Hand-craft a credential-export-bundle blob with an arbitrary createdAt (for expiry fixtures). */ From dcebf8d8e8fb98d392cdc02400e6b8a616ef1904 Mon Sep 17 00:00:00 2001 From: Will Gordon Date: Tue, 27 Oct 2026 22:35:57 -0400 Subject: [PATCH 3/7] fix(lint): narrows Jira search params before stringifying --- CONTRIBUTING.md | 2 +- src/worker/index.ts | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6ef2d21f..5c531521 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -149,6 +149,6 @@ git push upstream main --follow-tags All PRs target `main` on `gordon-code/github-tracker`. Keep PRs focused — one feature or fix per PR makes review faster and reverts cleaner. -In the PR body, describe what changed and why. CI runs typecheck, unit tests, and E2E tests automatically. PRs need a passing CI run before merge. +In the PR body, describe what changed and why. CI runs typecheck, lint, unit tests, and E2E tests automatically. PRs need a passing CI run before merge. When adding or changing user-facing features, update [docs/USER_GUIDE.md](docs/USER_GUIDE.md) to reflect the changes. diff --git a/src/worker/index.ts b/src/worker/index.ts index 695960e4..f3aa134c 100644 --- a/src/worker/index.ts +++ b/src/worker/index.ts @@ -1430,9 +1430,16 @@ async function handleJiraProxy( // GET with params as query string — only allowlisted keys forwarded const searchParams = new URLSearchParams(); if (params && typeof params === "object") { - for (const [k, v] of Object.entries(params as Record)) { - if (ALLOWED_SEARCH_PARAMS.has(k) && v !== undefined && v !== null) - searchParams.set(k, Array.isArray(v) ? v.join(",") : String(v)); + for (const [k, v] of Object.entries(params as Record)) { + if (!ALLOWED_SEARCH_PARAMS.has(k) || v === undefined || v === null) continue; + if (Array.isArray(v)) { + searchParams.set( + k, + v.filter((item): item is string | number | boolean => typeof item === "string" || typeof item === "number" || typeof item === "boolean").join(","), + ); + } else if (typeof v === "string" || typeof v === "number" || typeof v === "boolean") { + searchParams.set(k, String(v)); + } } } jiraUrl = `${baseUrl}?${searchParams.toString()}`; From 3070b4af1a8c3e1350a44fe5c621ca48c9cc33bd Mon Sep 17 00:00:00 2001 From: Will Gordon Date: Wed, 28 Oct 2026 12:59:58 -0400 Subject: [PATCH 4/7] ci(workflows): extract shared setup and verify composite actions --- .github/actions/setup/action.yml | 18 +++++++++++++ .github/actions/verify/action.yml | 41 ++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 20 +++------------ .github/workflows/deploy.yml | 16 +++--------- .github/workflows/publish-mcp.yml | 5 +--- .github/workflows/status-smoke.yml | 7 +---- tests/stores/cache.test.ts | 13 +++++++++- tests/worker/jira-oauth.test.ts | 28 ++++++++++++++++++++ 8 files changed, 107 insertions(+), 41 deletions(-) create mode 100644 .github/actions/setup/action.yml create mode 100644 .github/actions/verify/action.yml diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 00000000..5319516b --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,18 @@ +name: Setup Node and pnpm +description: Install pnpm, Node.js, and workspace dependencies with frozen lockfile +inputs: + registry-url: + description: Optional npm registry URL for actions/setup-node (used by npm publish) + required: false + default: "" +runs: + using: composite + steps: + - uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + node-version: 26.12.1 + cache: pnpm + registry-url: ${{ inputs.registry-url }} + - run: pnpm install --frozen-lockfile + shell: bash diff --git a/.github/actions/verify/action.yml b/.github/actions/verify/action.yml new file mode 100644 index 00000000..92a7d7f6 --- /dev/null +++ b/.github/actions/verify/action.yml @@ -0,0 +1,41 @@ +name: Verify +description: Setup toolchain and run CSP, typecheck, lint, unit, WAF smoke, and E2E checks +inputs: + vite-github-client-id: + description: VITE_GITHUB_CLIENT_ID for Playwright E2E tests + required: false + default: "" + deploy-domain: + description: Production domain for WAF smoke tests (skipped if empty) + required: false + default: "" +runs: + using: composite + steps: + - uses: ./.github/actions/setup + - name: Verify CSP inline script hash + shell: bash + run: bash scripts/verify-csp-hash.sh + - name: Typecheck + shell: bash + run: pnpm run typecheck + - name: Lint + shell: bash + run: pnpm lint + - name: Unit tests + shell: bash + run: pnpm test + - name: WAF smoke tests + if: inputs.deploy-domain != '' + shell: bash + run: pnpm test:waf "https://$DEPLOY_DOMAIN" + env: + DEPLOY_DOMAIN: ${{ inputs.deploy-domain }} + # No `playwright install` step: playwright.config.ts uses channel: "chrome", + # which resolves to ubuntu-latest's preinstalled Google Chrome — Playwright's + # own bundled Chromium download is never used and would be wasted work. + - name: Run E2E tests + shell: bash + run: pnpm test:e2e + env: + VITE_GITHUB_CLIENT_ID: ${{ inputs.vite-github-client-id }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c3e4112..4d031dc4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,21 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 - - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + - uses: ./.github/actions/verify with: - node-version: 26.12.1 - cache: pnpm - - run: pnpm install --frozen-lockfile - - name: Verify CSP inline script hash - run: bash scripts/verify-csp-hash.sh - - run: pnpm run typecheck - - run: pnpm lint - - run: pnpm test - # No `playwright install` step: playwright.config.ts uses channel: "chrome", - # which resolves to ubuntu-latest's preinstalled Google Chrome — Playwright's - # own bundled Chromium download is never used and would be wasted work. - - name: Run E2E tests - run: pnpm test:e2e - env: - VITE_GITHUB_CLIENT_ID: ${{ vars.VITE_GITHUB_CLIENT_ID }} + vite-github-client-id: ${{ vars.VITE_GITHUB_CLIENT_ID }} + deploy-domain: ${{ vars.DEPLOY_DOMAIN }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ac5a6254..e763fc3e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -10,20 +10,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 - - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + - uses: ./.github/actions/verify with: - node-version: 26.12.1 - cache: pnpm - - run: pnpm install --frozen-lockfile - - run: pnpm run typecheck - - run: pnpm lint - - run: pnpm test - - name: Verify CSP inline script hash - run: bash scripts/verify-csp-hash.sh - - name: WAF smoke tests - if: vars.DEPLOY_DOMAIN != '' - run: pnpm test:waf "https://${{ vars.DEPLOY_DOMAIN }}" + vite-github-client-id: ${{ vars.VITE_GITHUB_CLIENT_ID }} + deploy-domain: ${{ vars.DEPLOY_DOMAIN }} - name: Validate deploy configuration run: pnpm validate:deploy env: diff --git a/.github/workflows/publish-mcp.yml b/.github/workflows/publish-mcp.yml index a5d98e7c..dc167935 100644 --- a/.github/workflows/publish-mcp.yml +++ b/.github/workflows/publish-mcp.yml @@ -10,12 +10,9 @@ jobs: id-token: write steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 - - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + - uses: ./.github/actions/setup with: - node-version: 26.12.1 registry-url: "https://registry.npmjs.org" - - run: pnpm install --frozen-lockfile - run: pnpm --filter github-tracker-mcp run typecheck - run: pnpm --filter github-tracker-mcp run build - run: pnpm --filter github-tracker-mcp test diff --git a/.github/workflows/status-smoke.yml b/.github/workflows/status-smoke.yml index bb93b96d..5fb24879 100644 --- a/.github/workflows/status-smoke.yml +++ b/.github/workflows/status-smoke.yml @@ -10,10 +10,5 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 - - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 - with: - node-version: 26.12.1 - cache: pnpm - - run: pnpm install --frozen-lockfile + - uses: ./.github/actions/setup - run: pnpm test:status-smoke diff --git a/tests/stores/cache.test.ts b/tests/stores/cache.test.ts index a889da54..f085b70d 100644 --- a/tests/stores/cache.test.ts +++ b/tests/stores/cache.test.ts @@ -1,5 +1,6 @@ import "fake-indexeddb/auto"; import { describe, it, expect, beforeEach, afterEach, vi } from "vitest"; +import { captureException } from "@sentry/solid"; import { getDb, getCacheEntry, @@ -10,6 +11,10 @@ import { cachedFetch, } from "../../src/app/stores/cache"; +vi.mock("@sentry/solid", () => ({ + captureException: vi.fn(), +})); + // Reset the DB singleton between tests by closing and clearing beforeEach(async () => { // Clear all cache entries before each test @@ -79,6 +84,7 @@ describe("CRUD operations", () => { describe("setCacheEntry — QuotaExceededError eviction", () => { afterEach(() => { vi.restoreAllMocks(); + vi.mocked(captureException).mockClear(); }); it("evicts oldest 50% and retries when db.put throws QuotaExceededError on first call", async () => { @@ -122,15 +128,17 @@ describe("setCacheEntry — QuotaExceededError eviction", () => { const stored = await getCacheEntry("quota-new:key"); expect(stored).toBeDefined(); expect(stored!.data).toEqual({ new: true }); + expect(captureException).not.toHaveBeenCalled(); }); it("logs warning and resolves when retry after eviction also fails", async () => { const db = await getDb(); const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {}); + const quotaErr = new DOMException("QuotaExceededError", "QuotaExceededError"); // Throw QuotaExceededError on every put call vi.spyOn(db, "put").mockImplementation(async () => { - throw new DOMException("QuotaExceededError", "QuotaExceededError"); + throw quotaErr; }); // Should resolve (not throw) — entry is silently dropped @@ -138,6 +146,9 @@ describe("setCacheEntry — QuotaExceededError eviction", () => { expect(warnSpy).toHaveBeenCalledWith( expect.stringContaining("Still over quota") ); + expect(captureException).toHaveBeenCalledWith(quotaErr, { + tags: { source: "cache-eviction-retry" }, + }); }); }); diff --git a/tests/worker/jira-oauth.test.ts b/tests/worker/jira-oauth.test.ts index b7c52cfc..848f1e96 100644 --- a/tests/worker/jira-oauth.test.ts +++ b/tests/worker/jira-oauth.test.ts @@ -687,6 +687,34 @@ describe("POST /api/jira/proxy — Jira API proxy", () => { expect(init.method).toBe("GET"); }); + it("filters search array params to primitives and omits non-primitive scalar params", async () => { + const mockFetch = vi.fn().mockResolvedValueOnce( + new Response(JSON.stringify({ issues: [], total: 0, maxResults: 10, startAt: 0 }), { status: 200 }) + ); + globalThis.fetch = mockFetch; + + const req = makeJiraProxyRequest({ + endpoint: "search", + cloudId: VALID_CLOUD_ID, + email: TEST_EMAIL, + sealed: sealedToken, + params: { + jql: "project = TEST", + maxResults: 10, + fields: ["summary", 42, true, { nested: "skip" }, null], + startAt: { invalid: 1 }, + }, + }); + const res = await worker.fetch(req, makeEnv()); + expect(res.status).toBe(200); + + const [url] = mockFetch.mock.calls[0] as [string, RequestInit]; + const parsedUrl = new URL(url); + expect(parsedUrl.searchParams.get("fields")).toBe("summary,42,true"); + expect(parsedUrl.searchParams.has("startAt")).toBe(false); + expect(url).not.toContain("object+Object"); + }); + it("constructs correct target URL for issue endpoint", async () => { const mockFetch = vi.fn().mockResolvedValueOnce( new Response(JSON.stringify({ issues: [] }), { status: 200 }) From 6dc81ab2eeb6b58009ba4ebdea2c5ebcc13b8265 Mon Sep 17 00:00:00 2001 From: Will Gordon Date: Wed, 28 Oct 2026 13:46:00 -0400 Subject: [PATCH 5/7] test(cache): asserts distinct retry error in Sentry --- tests/stores/cache.test.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/stores/cache.test.ts b/tests/stores/cache.test.ts index f085b70d..f73b713b 100644 --- a/tests/stores/cache.test.ts +++ b/tests/stores/cache.test.ts @@ -134,19 +134,20 @@ describe("setCacheEntry — QuotaExceededError eviction", () => { it("logs warning and resolves when retry after eviction also fails", async () => { const db = await getDb(); const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {}); - const quotaErr = new DOMException("QuotaExceededError", "QuotaExceededError"); + const initialQuotaErr = new DOMException("QuotaExceededError (initial)", "QuotaExceededError"); + const retryQuotaErr = new DOMException("QuotaExceededError (retry)", "QuotaExceededError"); - // Throw QuotaExceededError on every put call - vi.spyOn(db, "put").mockImplementation(async () => { - throw quotaErr; - }); + // Throw distinct QuotaExceededError instances on initial and retry put calls + vi.spyOn(db, "put") + .mockRejectedValueOnce(initialQuotaErr) + .mockRejectedValueOnce(retryQuotaErr); // Should resolve (not throw) — entry is silently dropped await setCacheEntry("quota-retry-fail:key", { data: true }, null); expect(warnSpy).toHaveBeenCalledWith( expect.stringContaining("Still over quota") ); - expect(captureException).toHaveBeenCalledWith(quotaErr, { + expect(captureException).toHaveBeenCalledWith(retryQuotaErr, { tags: { source: "cache-eviction-retry" }, }); }); From 00a6783145ebc9aac9b846832ce2c5a148699817 Mon Sep 17 00:00:00 2001 From: Will Gordon Date: Wed, 28 Oct 2026 19:54:35 -0400 Subject: [PATCH 6/7] chore(lint): tightens tsconfig and oxlint rules - Enables noFallthroughCasesInSwitch, noImplicitOverride, isolatedModules, verbatimModuleSyntax, and forceConsistentCasingInFileNames across tsconfig.json, src/shared/tsconfig.json, and mcp/tsconfig.json - Expands tsconfig.lint.json and package.json lint scripts to cover all root and MCP config .ts files and fixes TS2305 in vitest.smoke.config.ts - Restores the oxc plugin and adds root options (typeAware, denyWarnings, reportUnusedDisableDirectives: error) in .oxlintrc.json - Enables eslint/no-unassigned-vars, promise/always-return, vitest/require-to-throw-message, and typescript/no-misused-spread globally and narrows remaining overrides to specific files --- .oxlintrc.json | 54 +++++++++++++++---- mcp/tests/integration.test.ts | 2 +- mcp/tests/ws-relay.test.ts | 5 +- mcp/tsconfig.json | 7 +++ package.json | 6 +-- .../components/dashboard/DashboardPage.tsx | 48 ++++++++++------- .../components/dashboard/JiraAssignedTab.tsx | 2 +- src/app/components/onboarding/OrgSelector.tsx | 2 +- .../components/onboarding/RepoSelector.tsx | 27 +++++----- src/app/components/settings/SettingsPage.tsx | 10 ++-- src/app/pages/LoginPage.tsx | 2 +- src/app/services/events.ts | 4 +- src/app/stores/auth.ts | 21 +++++--- src/shared/tsconfig.json | 7 +++ src/worker/index.ts | 6 +-- tests/app/lib/proxy.test.ts | 42 ++++----------- .../components/settings/JiraSection.test.tsx | 6 --- .../components/settings/SettingsTOC.test.tsx | 2 +- tests/lib/jira-utils.test.ts | 2 - tests/lib/sentry.test.ts | 2 +- tests/lib/settings-transfer.test.ts | 2 +- tests/lib/worker-sentry.test.ts | 2 - tests/services/github.test.ts | 10 ++-- tests/stores/auth.test.ts | 2 +- tests/stores/cache.test.ts | 1 - tests/stores/config.test.ts | 24 ++++----- tests/worker/turnstile.test.ts | 1 - tsconfig.json | 7 ++- tsconfig.lint.json | 5 +- vitest.smoke.config.ts | 6 +-- 30 files changed, 177 insertions(+), 140 deletions(-) diff --git a/.oxlintrc.json b/.oxlintrc.json index 9db11102..1dababc0 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -1,6 +1,11 @@ { "$schema": "./node_modules/oxlint/configuration_schema.json", - "plugins": ["typescript", "unicorn", "import", "promise", "vitest"], + "options": { + "typeAware": true, + "denyWarnings": true, + "reportUnusedDisableDirectives": "error" + }, + "plugins": ["typescript", "unicorn", "oxc", "import", "promise", "vitest"], "categories": { "correctness": "error", "suspicious": "warn", @@ -11,6 +16,7 @@ "mcp/dist/**", "**/node_modules/**", ".wrangler/**", + ".claude/**", "hack/**", "playwright-report/**", "test-results/**" @@ -19,23 +25,51 @@ "typescript/no-unsafe-type-assertion": "off", "eslint/no-underscore-dangle": "off", "unicorn/consistent-function-scoping": "off", - "eslint/no-unassigned-vars": "off", - "eslint/no-await-in-loop": "off", - "unicorn/prefer-add-event-listener": "off", - "import/no-unassigned-import": "off", - "promise/always-return": "off" + "import/no-unassigned-import": "off" }, "overrides": [ + { + "files": [ + "src/app/services/api.ts", + "src/app/services/events.ts", + "src/app/stores/cache.ts", + "src/app/components/settings/JiraFieldPicker.tsx" + ], + "rules": { + "eslint/no-await-in-loop": "off" + } + }, + { + "files": [ + "src/app/lib/mcp-relay.ts", + "src/app/lib/notifications.ts", + "src/app/lib/proxy.ts" + ], + "rules": { + "unicorn/prefer-add-event-listener": "off" + } + }, { "files": ["tests/**", "e2e/**", "mcp/tests/**"], + "plugins": ["typescript", "unicorn", "oxc", "import", "promise", "vitest"], "rules": { + "eslint/no-await-in-loop": "off", + "unicorn/prefer-add-event-listener": "off", "vitest/require-mock-type-parameters": "off", "vitest/expect-expect": "off", "typescript/unbound-method": "off", - "vitest/no-standalone-expect": "off", - "vitest/no-conditional-expect": "off", - "vitest/require-to-throw-message": "off", - "typescript/no-misused-spread": "off", + "vitest/no-conditional-expect": "off" + } + }, + { + "files": ["tests/**/*.steps.tsx", "tests/worker/crypto.test.ts"], + "rules": { + "vitest/no-standalone-expect": "off" + } + }, + { + "files": ["tests/lib/settings-transfer.test.ts"], + "rules": { "vitest/valid-expect": "off" } } diff --git a/mcp/tests/integration.test.ts b/mcp/tests/integration.test.ts index 67a63a25..be98a3f6 100644 --- a/mcp/tests/integration.test.ts +++ b/mcp/tests/integration.test.ts @@ -192,7 +192,7 @@ describe("Integration: WebSocket relay data flow", () => { const promise = sendRelayRequest(METHODS.GET_OPEN_PRS, {}); client.close(); - await expect(promise).rejects.toThrow(); + await expect(promise).rejects.toThrow("WebSocket relay disconnected"); expect(isRelayConnected()).toBe(false); }); diff --git a/mcp/tests/ws-relay.test.ts b/mcp/tests/ws-relay.test.ts index 1dd90bb5..8f894a83 100644 --- a/mcp/tests/ws-relay.test.ts +++ b/mcp/tests/ws-relay.test.ts @@ -103,8 +103,9 @@ describe("WebSocket relay server — connection", () => { beforeEach(async () => { process.env.MCP_WS_PORT = "0"; - wss = startWebSocketServer()!; - expect(wss).not.toBeNull(); + const started = startWebSocketServer(); + if (!started) throw new Error("Server not started"); + wss = started; await waitForEvent(wss, "listening"); port = getServerPort(wss); }); diff --git a/mcp/tsconfig.json b/mcp/tsconfig.json index 6295d45f..de881d1d 100644 --- a/mcp/tsconfig.json +++ b/mcp/tsconfig.json @@ -7,6 +7,13 @@ "moduleResolution": "nodenext", "target": "ES2022", "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "noImplicitOverride": true, + "isolatedModules": true, + "verbatimModuleSyntax": true, + "forceConsistentCasingInFileNames": true, "esModuleInterop": true, "skipLibCheck": true, "declaration": true, diff --git a/package.json b/package.json index 8d3187e1..0d295b73 100644 --- a/package.json +++ b/package.json @@ -11,9 +11,9 @@ "test": "vitest run --config vitest.workspace.ts", "test:watch": "vitest --config vitest.workspace.ts", "deploy": "wrangler deploy", - "typecheck": "tsc --build src/shared/tsconfig.json && tsc --noEmit && tsc --build mcp/tsconfig.json && tsc -p tsconfig.lint.json", - "lint": "oxlint --type-aware --tsconfig tsconfig.lint.json --deny-warnings src tests e2e mcp/tests vite.config.ts && oxlint --type-aware --tsconfig mcp/tsconfig.json --deny-warnings mcp/src", - "lint:fix": "oxlint --type-aware --tsconfig tsconfig.lint.json --fix src tests e2e mcp/tests vite.config.ts && oxlint --type-aware --tsconfig mcp/tsconfig.json --fix mcp/src", + "typecheck": "tsc --build src/shared/tsconfig.json && tsc --build mcp/tsconfig.json && tsc -p tsconfig.lint.json", + "lint": "oxlint --type-aware --tsconfig tsconfig.lint.json --deny-warnings src tests e2e mcp/tests vite.config.ts vitest.config.ts vitest.smoke.config.ts vitest.workspace.ts playwright.config.ts playwright.config.screenshot.ts mcp/tsup.config.ts mcp/vitest.config.ts && oxlint --type-aware --tsconfig mcp/tsconfig.json --deny-warnings mcp/src", + "lint:fix": "oxlint --type-aware --tsconfig tsconfig.lint.json --fix src tests e2e mcp/tests vite.config.ts vitest.config.ts vitest.smoke.config.ts vitest.workspace.ts playwright.config.ts playwright.config.screenshot.ts mcp/tsup.config.ts mcp/vitest.config.ts && oxlint --type-aware --tsconfig mcp/tsconfig.json --fix mcp/src", "test:e2e": "E2E_PORT=$(node -e \"const s=require('net').createServer();s.listen(0,()=>{console.log(s.address().port);s.close()})\") playwright test", "test:waf": "bash scripts/waf-smoke-test.sh", "test:status-smoke": "vitest run --config vitest.smoke.config.ts", diff --git a/src/app/components/dashboard/DashboardPage.tsx b/src/app/components/dashboard/DashboardPage.tsx index 653f0785..b04ae70a 100644 --- a/src/app/components/dashboard/DashboardPage.tsx +++ b/src/app/components/dashboard/DashboardPage.tsx @@ -1,7 +1,7 @@ import { createSignal, createMemo, createEffect, on, Show, Switch, Match, onMount, onCleanup, untrack } from "solid-js"; import { createStore, produce, unwrap } from "solid-js/store"; import Header from "../layout/Header"; -import TabBar, { TabId } from "../layout/TabBar"; +import TabBar, { type TabId } from "../layout/TabBar"; import FilterBar from "../layout/FilterBar"; import ActionsTab from "./ActionsTab"; import IssuesTab from "./IssuesTab"; @@ -429,7 +429,7 @@ async function pollFetch(): Promise { } } })); - resolvedPullRequests = unwrap(dashboardData.pullRequests).map((pr) => ({ ...pr })); + resolvedPullRequests = unwrap(dashboardData.pullRequests).map((pr) => Object.assign({}, pr)); } else { // Phase 1 did NOT fire (cached data existed or subsequent poll). // Full atomic replacement — all fields (light + heavy) may have @@ -723,7 +723,8 @@ export default function DashboardPage() { } function fetchAndSetRlDetail(): void { - void fetchRateLimitDetails().then((detail) => { + void (async () => { + const detail = await fetchRateLimitDetails(); if (!detail) { setRlDetail("Failed to load"); return; @@ -734,11 +735,10 @@ export default function DashboardPage() { `GraphQL: ${detail.graphql.remaining.toLocaleString()}/${detail.graphql.limit.toLocaleString()} remaining\n` + `Resets: ${resetTime}` ); - }); + })(); } if (import.meta.env.DEV) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any (window as any).__debug = { forceHotPoll: () => { const allPrIds = new Set(dashboardData.pullRequests.map(pr => pr.id)); @@ -958,18 +958,21 @@ export default function DashboardPage() { // Only adds orgs to the filter list — repos are user-selected via Settings. const client = getClient(); if (client && config.onboardingComplete) { - void fetchOrgs(client).then((allOrgs) => { - const currentSet = new Set(config.selectedOrgs.map((o) => o.toLowerCase())); - const newOrgs = allOrgs - .map((o) => o.login) - .filter((login) => !currentSet.has(login.toLowerCase())); - if (newOrgs.length > 0) { - setConfig("selectedOrgs", [...config.selectedOrgs, ...newOrgs]); - console.info(`[dashboard] auto-synced ${newOrgs.length} new org(s)`); + void (async () => { + try { + const allOrgs = await fetchOrgs(client); + const currentSet = new Set(config.selectedOrgs.map((o) => o.toLowerCase())); + const newOrgs = allOrgs + .map((o) => o.login) + .filter((login) => !currentSet.has(login.toLowerCase())); + if (newOrgs.length > 0) { + setConfig("selectedOrgs", [...config.selectedOrgs, ...newOrgs]); + console.info(`[dashboard] auto-synced ${newOrgs.length} new org(s)`); + } + } catch { + // Non-fatal — org sync failure doesn't block dashboard } - }).catch(() => { - // Non-fatal — org sync failure doesn't block dashboard - }); + })(); } // Backfill config.jira.siteUrl from auth state if missing (handles configs @@ -1294,10 +1297,15 @@ export default function DashboardPage() { ...dashboardData.issues.map((i) => ({ title: i.title })), ...dashboardData.pullRequests.map((p) => ({ title: p.title, headRef: p.headRef })), ]; - void detectAndLookupJiraKeys(items, client).then((map) => { - if (import.meta.env.DEV) console.info("[jira] key detection:", map.size, "keys found", [...map.keys()].slice(0, 10)); - setJiraKeyMap(map); - }).catch(handleJiraError); + void (async () => { + try { + const map = await detectAndLookupJiraKeys(items, client); + if (import.meta.env.DEV) console.info("[jira] key detection:", map.size, "keys found", [...map.keys()].slice(0, 10)); + setJiraKeyMap(map); + } catch (err) { + handleJiraError(err); + } + })(); })); // Re-fetch Jira assigned issues when Jira auth transitions false -> true diff --git a/src/app/components/dashboard/JiraAssignedTab.tsx b/src/app/components/dashboard/JiraAssignedTab.tsx index 8b54c2b7..bc8d82c3 100644 --- a/src/app/components/dashboard/JiraAssignedTab.tsx +++ b/src/app/components/dashboard/JiraAssignedTab.tsx @@ -289,7 +289,7 @@ export default function JiraAssignedTab(props: JiraAssignedTabProps) { const result = filteredSorted().map((issue): JiraItem => { const cached = itemsWithGroupKeyCache.get(issue.key); if (cached && cached.source === issue) return cached.wrapped; - const wrapped: JiraItem = { ...issue, repoFullName: issue.fields.project?.key ?? "OTHER" }; + const wrapped: JiraItem = Object.assign({}, issue, { repoFullName: issue.fields.project?.key ?? "OTHER" }); itemsWithGroupKeyCache.set(issue.key, { source: issue, wrapped }); return wrapped; }); diff --git a/src/app/components/onboarding/OrgSelector.tsx b/src/app/components/onboarding/OrgSelector.tsx index 9d8850f4..74878f01 100644 --- a/src/app/components/onboarding/OrgSelector.tsx +++ b/src/app/components/onboarding/OrgSelector.tsx @@ -1,5 +1,5 @@ import { createSignal, createResource, createEffect, untrack, For, Show } from "solid-js"; -import { fetchOrgs, OrgEntry } from "../../services/api"; +import { fetchOrgs, type OrgEntry } from "../../services/api"; import { getClient } from "../../services/github"; import { pushNotification } from "../../lib/errors"; import LoadingSpinner from "../shared/LoadingSpinner"; diff --git a/src/app/components/onboarding/RepoSelector.tsx b/src/app/components/onboarding/RepoSelector.tsx index cb743c52..0b9ab121 100644 --- a/src/app/components/onboarding/RepoSelector.tsx +++ b/src/app/components/onboarding/RepoSelector.tsx @@ -7,7 +7,7 @@ import { Index, For, } from "solid-js"; -import { fetchOrgs, fetchRepos, discoverUpstreamRepos, OrgEntry, RepoRef, RepoEntry } from "../../services/api"; +import { fetchOrgs, fetchRepos, discoverUpstreamRepos, type OrgEntry, type RepoRef, type RepoEntry } from "../../services/api"; import { REPO_CAP } from "../../../shared/types"; import { getClient } from "../../services/github"; import { user } from "../../stores/auth"; @@ -291,18 +291,18 @@ export default function RepoSelector(props: RepoSelectorProps) { }); const ownedOrgs = new Set(orgs.map((o) => o.toLowerCase())); ownedOrgs.add(currentUser.login.toLowerCase()); - void discoverUpstreamRepos(discoveryClient, currentUser.login, allOrgFullNames, props.trackedUsers) - .then((repos) => { + void (async () => { + try { + const repos = await discoverUpstreamRepos(discoveryClient, currentUser.login, allOrgFullNames, props.trackedUsers); if (version !== effectVersion) return; setDiscoveredRepos(repos.filter((r) => !ownedOrgs.has(r.owner.toLowerCase()))); setDiscoveryCapped(repos.length >= 100); - }) - .catch(() => { + } catch { // Non-fatal — partial results may already be in state - }) - .finally(() => { + } finally { if (version === effectVersion) setDiscoveringUpstream(false); - }); + } + })(); } } })(); @@ -323,16 +323,16 @@ export default function RepoSelector(props: RepoSelectorProps) { const state = orgStates().find((s) => s.org === org); const type = state?.type ?? "org"; - void fetchRepos(client, org, type) - .then((repos) => { + void (async () => { + try { + const repos = await fetchRepos(client, org, type); if (version !== effectVersion) return; setOrgStates((prev) => prev.map((s) => s.org === org ? { ...s, repos, loading: false, error: null } : s ) ); - }) - .catch((err) => { + } catch (err) { if (version !== effectVersion) return; const message = err instanceof Error ? err.message : "Failed to load repositories"; @@ -341,7 +341,8 @@ export default function RepoSelector(props: RepoSelectorProps) { s.org === org ? { ...s, loading: false, error: message } : s ) ); - }); + } + })(); } // ── Selection helpers ────────────────────────────────────────────────────── diff --git a/src/app/components/settings/SettingsPage.tsx b/src/app/components/settings/SettingsPage.tsx index a41e6168..dcf59b31 100644 --- a/src/app/components/settings/SettingsPage.tsx +++ b/src/app/components/settings/SettingsPage.tsx @@ -1640,7 +1640,7 @@ export default function SettingsPage() { {config.jira?.authMethod === "token" ? "API Token" : "OAuth"}