diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9f3ce90..c8bf4c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ env: jobs: build: - name: Type-check + build + name: Lint + type-check + build runs-on: ubuntu-latest timeout-minutes: 10 steps: @@ -66,6 +66,13 @@ jobs: - name: Install dependencies run: pnpm install --no-frozen-lockfile + # Lint ran on nothing for months: `next lint` was removed in Next 16 + # and no eslint config existed, so `pnpm lint` just errored and no + # workflow called it. Wired in here so it cannot rot silently again. + # Source-only — needs no content sync. + - name: Lint + run: pnpm lint + # `prebuild` + `pretypecheck` both run scripts/sync-content.mjs # which clones github.com/agentproto/ts into .cache/ at depth 1. # Public repo — no auth needed. diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..a50ceea --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,49 @@ +// ESLint flat config — Next.js 16 dropped the `next lint` subcommand, so +// `pnpm lint` runs the `eslint` binary directly against this file. +// +// `eslint-config-next` ships flat configs natively (no @eslint/eslintrc +// FlatCompat shim needed). `core-web-vitals` already spreads the base +// `eslint-config-next` config, so the two entries below are the flat +// equivalent of the legacy `extends: ["next/core-web-vitals", +// "next/typescript"]`. +// +// Kept byte-identical with the sibling repo (agentproto/site ⇄ +// agentproto/cli-site) — the two are near-identical Next + fumadocs +// codebases sharing components and scripts. +import nextCoreWebVitals from "eslint-config-next/core-web-vitals" +import nextTypescript from "eslint-config-next/typescript" + +const config = [ + { + // `eslint-config-next` already ignores .next/, out/, build/ and + // next-env.d.ts. These are the repo-specific generated trees: + // .source/ — fumadocs-mdx compiled content tree + // .cache/ — depth-1 clone of the upstream content repo, pulled by + // scripts/sync-content.mjs at dev/build time + // content/ — synced MDX + authored specs, not linted as source + ignores: [".source/**", ".cache/**", ".turbo/**", "content/**"], + }, + { + // A stale `eslint-disable` is how lint silently rots: the rule stops + // running, the comment stays, nobody notices. Fail on it — in editors + // too, which a CLI flag would not cover. + linterOptions: { reportUnusedDisableDirectives: "error" }, + }, + ...nextCoreWebVitals, + ...nextTypescript, + { + rules: { + // React-Compiler-era advisories, new in eslint-plugin-react-hooks v7 + // (pulled in by eslint-config-next 16). They are performance advice, + // not correctness bugs, and the cli-site daemon panel is built on the + // patterns they flag: reset-state-on-session-change effects and refs + // mirrored during render. Converting ~11 of those call sites is a + // behavioural refactor of a live interactive UI — its own change, not + // a rider on the lint migration. Off for now, tracked separately. + "react-hooks/set-state-in-effect": "off", + "react-hooks/refs": "off", + }, + }, +] + +export default config diff --git a/package.json b/package.json index 8072760..2e1f4ba 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "prebuild": "node scripts/sync-content.mjs", "build": "next build", "start": "next start", - "lint": "next lint", + "lint": "eslint . --max-warnings=0", "pretypecheck": "node scripts/sync-content.mjs && fumadocs-mdx", "typecheck": "tsc --noEmit", "clean": "rm -rf .next .source content/docs .cache" @@ -41,6 +41,8 @@ "@types/node": "^24.12.3", "@types/react": "19.2.14", "@types/react-dom": "19.2.3", + "eslint": "^9.39.4", + "eslint-config-next": "^16.2.6", "tailwindcss": "^4.3.0", "typescript": "^5.9.3" }, diff --git a/postcss.config.js b/postcss.config.js index fb05b56..2f8795a 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -1,5 +1,7 @@ -export default { +const config = { plugins: { "@tailwindcss/postcss": {}, }, } + +export default config diff --git a/src/components/SessionChatView.tsx b/src/components/SessionChatView.tsx index c5816d6..2b122ef 100644 --- a/src/components/SessionChatView.tsx +++ b/src/components/SessionChatView.tsx @@ -64,7 +64,6 @@ function parseCost(n: number): string { * Accepts any wire value — normalises to string via toDisplayText first. */ function cleanToolText(raw: unknown): string { const s0 = toDisplayText(raw) - // eslint-disable-next-line no-control-regex let s = s0.replace(/\x1b\[[0-9;]*[A-Za-z]/g, "") s = s.replace(/\[[0-9;]*m/g, "") s = s @@ -952,7 +951,7 @@ export function SessionChatView({ daemonUrl, sessionId, sessionStatus }: Props) }} >
no structured transcript for this session
-
PTY / terminal sessions don't produce a structured export
+
PTY / terminal sessions don't produce a structured export
)} diff --git a/src/components/SessionTerminal.tsx b/src/components/SessionTerminal.tsx index bcd49ca..652895b 100644 --- a/src/components/SessionTerminal.tsx +++ b/src/components/SessionTerminal.tsx @@ -197,7 +197,7 @@ function attachPty({ } }) - sock.addEventListener("close", ev => { + sock.addEventListener("close", () => { if (!active || exited) return attempts++ if (attempts > MAX) { diff --git a/src/components/ToolBlocks.tsx b/src/components/ToolBlocks.tsx index 5e17981..961dd6e 100644 --- a/src/components/ToolBlocks.tsx +++ b/src/components/ToolBlocks.tsx @@ -56,7 +56,6 @@ export function toDisplayText(value: unknown): string { * Accepts any wire value and normalises it first via toDisplayText. */ export function cleanToolText(raw: unknown): string { const s0 = toDisplayText(raw) - // eslint-disable-next-line no-control-regex let s = s0.replace(/\x1b\[[0-9;]*[A-Za-z]/g, "") s = s.replace(/\[[0-9;]*m/g, "") s = s