Skip to content

chore(cli-site): migrate lint to ESLint 9 flat config - #11

Draft
agentiknet wants to merge 1 commit into
mainfrom
chore/eslint-flat-config
Draft

agentiknet wants to merge 1 commit into
mainfrom
chore/eslint-flat-config

Conversation

@agentiknet

@agentiknet agentiknet commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Why

pnpm lint has been broken in this repo. It runs next lint, a subcommand
Next.js 16 removed, and the repo carries no eslint config at all. So the
script just errors — and no workflow ever called it. Nothing has been linted
here for months.

What

Migrate to the setup Next 16 expects — eslint + eslint-config-next via
eslint.config.mjs (flat config).

  • eslint.config.mjs — eslint-config-next 16 ships flat configs
    natively, so no @eslint/eslintrc FlatCompat shim. core-web-vitals +
    typescript are the flat equivalent of the legacy
    extends: ["next/core-web-vitals", "next/typescript"].
    Byte-identical with the site sibling — the two repos share components
    and scripts.
  • reportUnusedDisableDirectives: "error" — a suppression can no longer
    outlive the rule it suppresses. That is precisely how this rotted, and it
    applies in editors too, which a CLI flag would not. It immediately earned
    its keep (see below).
  • lint script → eslint . --max-warnings=0.
  • CI now runs pnpm lint (source-only, needs no content sync), so it
    cannot go silently non-functional again. Job renamed to
    Lint + type-check + build; main has no branch protection, so no required
    check name is disturbed.

Violations surfaced — 14 errors, 1 warning

Fixed:

  • Two dead no-control-regex suppressions (SessionChatView.tsx:67,
    ToolBlocks.tsx:59) — that rule is not part of eslint-config-next, so
    those comments never suppressed anything. Removed. If we want the guard on
    these ANSI-stripping regexes it is a one-line rules addition; left out to
    keep the config vanilla-Next. Say the word and I will add it.
  • react/no-unescaped-entities — escaped an apostrophe in
    SessionChatView.tsx.
  • @typescript-eslint/no-unused-vars — dropped the unused ev param on the
    PTY socket close handler.

Re-scoped, not fixed — react-hooks/set-state-in-effect and
react-hooks/refs turned off in the config, with the rationale written into
the file:

These are 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. They flag ~11 sites across panel/page.tsx,
SessionChatView.tsx, use-daemon.ts and use-session-events.ts — the
reset-state-on-session-change effects and the refs mirrored during render that
the daemon panel is built on. Converting those is a behavioural refactor of a
live interactive UI and belongs in its own PR where it can actually be
exercised against a running daemon — not as a rider on a lint migration.

Happy to split that follow-up out if you want it tracked as an issue.

Verification

  • pnpm lint → exit 0, 0 errors, 0 warnings, 0 unused directives
  • tsc --noEmit → exit 0

Not in scope

The site repos have no committed lockfile (CI installs with
--no-frozen-lockfile); they resolve from the agentik-studio root lockfile,
where the two new devDeps land as a separate commit.

Coordination

Sibling PR: agentproto/site — same branch name, identical
eslint.config.mjs. Merge together.

Independent of the in-flight copy-only PR #10 (copy/facts-refresh-2026-09);
this branched from origin/main.

⚠️ CI is red for an unrelated, pre-existing reason

The new Lint step passes. So does Type-check. The Build step fails —
and it already failed before this branch existed:

prebuild clones agentproto/ts@main into content/docs/ at build time, so
the site build tracks upstream CLI docs. sandbox-rendezvous.mdx has drifted
into MDX that fumadocs-mdx rejects (a <!-- --> HTML comment, which MDX does
not accept). Last green run on main here was 2026-07-12.

That means the site build — and therefore the deploy — is currently broken
independently of lint.
It needs a fix in agentproto/ts, not here.
Tracking separately.

Next 16 removed the `next lint` subcommand and the repo carried no eslint
config, so `pnpm lint` has been erroring out — nothing has been linted for
months, and no workflow called it either.

- add eslint + eslint-config-next as devDeps; eslint-config-next 16 ships
  flat configs natively, so no @eslint/eslintrc FlatCompat shim is needed
- eslint.config.mjs = core-web-vitals + typescript (the flat equivalent of
  the legacy next/core-web-vitals + next/typescript extends), kept
  byte-identical with the site sibling
- reportUnusedDisableDirectives: error, so a suppression cannot outlive the
  rule it suppresses — which is exactly how this rotted
- lint script runs `eslint . --max-warnings=0`; wire it into CI

Violations the newly-live lint surfaced:
- drop two dead `no-control-regex` suppressions — that rule is not part of
  eslint-config-next, so the comments never suppressed anything
- escape an apostrophe in SessionChatView (react/no-unescaped-entities)
- drop the unused `ev` param on the PTY socket close handler
- turn off react-hooks/set-state-in-effect + react-hooks/refs, new
  React-Compiler advisories from eslint-plugin-react-hooks v7. They flag ~11
  sites in the daemon panel (reset-on-session-change effects, refs mirrored
  during render). Converting those is a behavioural refactor of a live
  interactive UI, not a rider on a lint migration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant