Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .agents/decisions/0002-quality-gates-as-code.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 2. Quality gates are code, enforced locally and in CI

- **Status:** Accepted, amended by [0028](0028-pre-push-runs-the-full-local-gate-suite.md) and [0062](0062-pre-commit-steps-stay-under-30-seconds.md)
- **Status:** Accepted, amended by [0028](0028-pre-push-runs-the-full-local-gate-suite.md), [0062](0062-pre-commit-steps-stay-under-30-seconds.md) and [0126](0126-oxlint-owns-all-lint-biome-only-formats.md)
- **Date:** 2026-06-17
- **Superseded in part by:** [ADR 0073](0073-adopt-the-typescript-toolchain-standard.md)
for Biome lint ownership; implementation follows in separate PRs.
Expand All @@ -25,6 +25,10 @@ earliest point it can fail:
- **CI:** all of the above re-run on a clean checkout, plus dependency + secret
security audit.

Amended by [ADR 0126](0126-oxlint-owns-all-lint-biome-only-formats.md): the
pre-commit Biome step now formats, orders imports and lints JSON and CSS
only, and Oxlint (`pnpm lint:policy`) owns the rest of lint.

The local hooks and CI run the *same* checks, so "passes on my machine" and
"passes in CI" converge. `pnpm verify` is the single local command that mirrors
the gate suite.
Expand Down
5 changes: 3 additions & 2 deletions .agents/decisions/0010-lint-engine-ownership.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# 10. Lint engines own disjoint concerns

- **Status:** Accepted; Superseded in part by ADR 0103 (lint engine); amended
by [0098](0098-oxlint-replaces-eslint.md)
- **Status:** Superseded by [0126](0126-oxlint-owns-all-lint-biome-only-formats.md);
earlier superseded in part by ADR 0103 (lint engine) and amended by
[0098](0098-oxlint-replaces-eslint.md)
- **Date:** 2026-10-15
- **Superseded in part by:** [ADR 0073](0073-adopt-the-typescript-toolchain-standard.md)
for Biome lint ownership; implementation follows in separate PRs.
Expand Down
4 changes: 3 additions & 1 deletion .agents/decisions/0103-eslint-is-retired.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# 103. ESLint is retired; Oxlint is the only policy lint engine

- **Status:** Accepted (merged in #284)
- **Status:** Accepted (merged in #284); amended by
[0126](0126-oxlint-owns-all-lint-biome-only-formats.md), which makes Oxlint the
only lint engine
- **Date:** 2026-11-01
- **Replaces:** ADR 0015 (deleted), whose React Doctor CLI split now lives in
[0102](0102-react-doctor-rules-run-as-an-oxlint-plugin.md), and, with
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# 125. Pre-commit runs every lint, style and architecture gate

- **Status:** Proposed (the maintainer accepts it by approving the PR)
- **Date:** 2026-11-08
- **Amends:** [0062](0062-pre-commit-steps-stay-under-30-seconds.md) for the
list of pre-commit steps

## Context

The factory writes coding standards, conventions and architecture boundaries
as lint rules. Those rules pay off when the agent hears about a mistake inside
its own loop, seconds after making it. Before this change `.husky/pre-commit`
ran typecheck, staged Biome, `pnpm lint:anti-slop`, `pnpm fallow:audit` and
`pnpm secret-scan`. Four gates ran only at push and in CI:

- `pnpm lint:policy`: Oxlint with `oxlint.config.ts`, which from
[ADR 0126](0126-oxlint-owns-all-lint-biome-only-formats.md) holds every lint
rule except the anti-slop set.
- `pnpm lint:styles`: the style-token check over CSS and `index.html`
([ADR 0114](0114-tailwind-on-the-ui-design-tokens.md)). Its TypeScript twin,
`policy/no-arbitrary-styles`, lives in `pnpm lint:policy`.
- `pnpm check:suppressions`: the ban on inline lint and coverage suppressions.
Without it at commit, an `oxlint-disable` comment passed pre-commit.
- `pnpm arch:gate`: Fallow architecture zones, the folder structure check and
the role diagram check.

BulletproofRepository made this change first, in its ADRs 0123 and 0127. This
record brings the same hook layout upstream.

[ADR 0062](0062-pre-commit-steps-stay-under-30-seconds.md) lets a step into
pre-commit only when it finishes in under 30 seconds, with timings recorded.
On 8 November 2026, on one Apple M2 Max with load averages of 5 to 24 from
other work, the median of five wall-clock runs of each step, with
[ADR 0126](0126-oxlint-owns-all-lint-biome-only-formats.md) applied, on the
whole repository and after a one-file staged change, was:

| Step | Whole repository | One staged file |
| --- | --- | --- |
| `pnpm typecheck` | 0.84 s | 0.90 s |
| staged Biome | 0.14 s | 0.10 s |
| `pnpm lint:policy` | 1.40 s | 1.44 s |
| `pnpm lint:styles` | 0.66 s | 0.67 s |
| `pnpm lint:anti-slop` | 1.05 s | 1.03 s |
| `pnpm check:suppressions` | 1.14 s | 1.18 s |
| `pnpm arch:gate` | 1.86 s | 1.93 s |
| `pnpm fallow:audit` | 2.82 s | 1.55 s |
| `pnpm secret-scan` | 1.18 s | 1.56 s |

The whole hook takes about 11 seconds. The slowest step takes under
3 seconds, a tenth of the budget.

## Decision

- `.husky/pre-commit` runs, in order: `pnpm typecheck`, staged Biome,
`pnpm lint:policy`, `pnpm lint:styles`, `pnpm lint:anti-slop`,
`pnpm check:suppressions`, `pnpm arch:gate`, `pnpm fallow:audit` and
`pnpm secret-scan`. The architecture gate runs before the Fallow audit so a
boundary violation is reported by the gate that owns boundaries.
- React Doctor's project scan stays in `pnpm verify` and CI. It calls a
third-party score API, and a commit must not depend on one.
- Every new hook step keeps its CI twin: `lint:policy`, `lint:styles` and
`check:suppressions` in the `quality` job, `arch:gate` in the `fallow` job.
The contract in `scripts/required-gates.mjs` names `.husky/pre-commit` as a
source for each, and `docs/required-gates.md` is regenerated.
- This change tightens enforcement. It loosens no rule, threshold or allowlist.

## Consequences

Pre-commit takes about 5 seconds longer. Each step stays well inside the
ADR 0062 budget. A lint error, a style-token break, an inline suppression or
an architecture boundary violation now stops `git commit` with the rule name,
file and line. Push and CI still run the same commands, so a bypassed hook is
caught later.

Policy lint, the style check, anti-slop lint, the suppression scan and the
architecture gate read the files on disk, like typecheck, not the staged
snapshot. Biome and gitleaks read staged content. So a staged violation whose
working-tree copy is fixed but unstaged can pass at commit; pre-push and CI
run the same commands on the pushed tree and fail it there. An untracked file
with a finding also stops a commit that does not include it: stage, stash or
delete it.

Revert the hook lines, the contract sources and the regenerated inventory
together to restore the previous hook.
149 changes: 149 additions & 0 deletions .agents/decisions/0126-oxlint-owns-all-lint-biome-only-formats.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# 126. Oxlint owns all code lint; Biome formats and lints JSON and CSS

- **Status:** Proposed (the maintainer accepts it by approving the PR)
- **Date:** 2026-11-08
- **Supersedes:** [0010](0010-lint-engine-ownership.md)
- **Implements:** [0073](0073-adopt-the-typescript-toolchain-standard.md)
tasks T16 (Oxlint as main linter) and T17 (Biome formatting only)
- **Amends:** [0103](0103-eslint-is-retired.md) for the engine list, and
[0002](0002-quality-gates-as-code.md) for the pre-commit lint engine

## Context

Two engines linted this repository. Biome ran 230 rules: 219 from its
recommended preset and `biome.json` at the root, two naming rules in package
sources, and nine domain rules that `biome rage` does not list. Biome turns a
domain on for every file under a `package.json` that lists the domain's
dependency. The React domain ran six rules in `apps/web` and `packages/ui`
(`useJsxKeyInIterable`, `noArrayIndexKey`, `noChildrenProp`,
`noDangerouslySetInnerHtml`, `noDangerouslySetInnerHtmlWithChildren`,
`noRenderReturnValue`); its other two recommended rules,
`useExhaustiveDependencies` and `useHookAtTopLevel`, are off in `biome.json`
because Oxlint's React hooks rules own them. The test domain ran
`noFocusedTests`, `noExportsInTest` and `noDuplicateTestHooks` in files under
the root package, which lists Jest. Biome also linted JSON and CSS.

Oxlint ran `oxlint.config.ts` (policy, React hooks and Compiler, Tailwind and
349 React Doctor rules) and `.oxlintrc.json` (anti-slop). Each rule had one
owner, but an agent had to know which engine reported which concern, and
`oxlint.config.ts` excluded 47 React Doctor rules because Biome owned them.
ADR 0073 already chose Oxlint for general lint and Biome for formatting; this
record carries that out.

The spike behind this record (8 November 2026, Oxlint 1.89.0, Biome 2.5.1)
mapped every Biome rule that ran on `main` to a native Oxlint rule:

| Biome category | Rules | Exact or close native rule | Covered elsewhere | No equivalent | Not applicable |
| --- | --- | --- | --- | --- | --- |
| a11y | 37 | 35 | 0 | 2 | 0 |
| complexity | 34 | 27 | 3 | 4 | 0 |
| correctness | 55 | 34 | 1 | 14 | 6 |
| performance | 2 | 1 | 0 | 1 | 0 |
| security | 5 | 5 | 0 | 0 | 0 |
| style | 16 | 14 | 0 | 1 | 1 |
| suspicious | 81 | 61 | 4 | 11 | 5 |

"Covered elsewhere" means the parser, `tsc` or an existing policy rule
already rejects the code. "Not applicable" is GraphQL rules, rules about
Biome's own suppression comments, and `useGoogleFontDisplay`, a Next.js rule.
Of the 33 rules with no equivalent, 26 lint CSS or HTML, which Oxlint does not
parse; this repository has two CSS files and one HTML file, and
`pnpm lint:styles` owns their token policy. The other seven are
`noStringCaseMismatch`, `noSuspiciousSemicolonInJsx`, `noSvgWithoutTitle`,
`noEmptyTypeParameters` (which `tsc` rejects), `noDynamicNamespaceImportAccess`
and two cosmetic rules (`noUselessStringRaw`, `useSimpleNumberKeys`).
Four close rules stay off. Three need type-aware linting (`useLiteralKeys`,
`useOptionalChain`, `useExportType`) until this repository runs
`oxlint --type-aware`. `unicorn/no-useless-undefined` is broader than
`noUselessUndefinedInitialization` and reports 32 places Biome accepted.
`useNamingConvention` has no Oxlint rule, so `tooling/oxlint-plugin-naming.js`
ports it. On the same source it reports the same names as Biome in 60 cases
across every selector the repository uses.

Timed on the same machine, median of seven interleaved runs, the lint step
did not get slower:

| Lint step | Whole repository | One staged file |
| --- | --- | --- |
| Before: staged Biome (lint, format, imports) + `pnpm lint:policy` | 0.95 s | 1.89 s |
| After: staged Biome (format, imports) + `pnpm lint:policy` with general rules | 0.96 s | 1.88 s |

Loading the JavaScript plugins dominates `pnpm lint:policy`; the native
general rules add about 50 ms. Biome's formatter alone checks the repository
in about 0.14 s, so no faster formatter would change the commit loop.
Oxfmt 0.77 (beta) formats the TypeScript identically except `it.each` tables
in 26 test files; dprint differed on 120 files. Biome stays the formatter.

The candidate config found one issue on the repository: `react/button-has-type`
on `packages/ui/src/Button.tsx`, which forwarded `type` from a prop. The
button now sets `type="button"` before spreading props, so a caller's `type`
still wins.

## Decision

- Oxlint owns every lint rule for JavaScript and TypeScript.
`pnpm lint:policy` runs `oxlint.config.ts`,
which spreads `tooling/oxlint-general-rules.ts` into its root rules: 170
native rules, each naming the Biome rule it replaces, including the React
and test domain rules. They run in every linted file, not only where Biome's
domains applied. `pnpm lint` runs the same command. `pnpm lint:anti-slop`
keeps the vendored anti-slop rules.
- The general rules match Biome's strength where an option allows it:
`no-unused-vars` checks every argument and caught error (an `_` prefix
opts out), `no-sequences` rejects a parenthesised comma, and
`no-empty-function`, `func-style` and `no-multi-assign` cover the parts of
`noEmptyBlockStatements`, `useArrowFunction` and `noAssignInExpressions`
that their closest rules miss.
- `oxlint.config.ts` enables the `typescript`, `jsx-a11y`, `oxc` and `jest`
plugins. Package sources get `naming/naming-convention` and
`unicorn/filename-case`, the ports of Biome's naming override.
- The 47 React Doctor rules that Biome owned stay excluded; each now names
the native Oxlint rule that owns its check.
- `biome.json` sets `linter.enabled` to `false`, then turns Biome's
recommended rules back on for `.json`, `.jsonc` and `.css` files only,
through one override. Oxlint cannot parse JSON or CSS, so Biome keeps the
checks for those files: duplicate JSON keys (`noDuplicateObjectKeys`) and
the 25 CSS rules, such as duplicate, unknown or overridden properties and
unknown units. Biome formats every file and orders imports. The staged
pre-commit step (`biome check --staged`) and `pnpm check` in `pnpm verify`
and CI run both. No JavaScript or TypeScript file gets a Biome lint rule.
- `scripts/lint-usage.mjs` records `pnpm lint:policy` findings at each
pre-commit attempt as well as Biome and anti-slop findings
([ADR 0100](0100-record-per-rule-lint-failures-on-every-pre-commit.md)).

## Consequences

An agent reads every finding in JavaScript and TypeScript from one engine and
one config, and every finding in JSON and CSS from Biome. Of the 33 rules with
no Oxlint equivalent, the 25 CSS rules keep running in Biome. The other eight
stop running: the seven JavaScript rules listed above and
`noDuplicateAttributes`, the one HTML rule, which applies to
`apps/web/index.html` only. Some are correctness checks, such as
`noStringCaseMismatch`; tests, `tsc`, `pnpm lint:styles` and review are the
remaining defence. Turning Biome's linter off is a loosening
that the enforcement gate reports, so this change needs the approver's
sign-off.

Three checks now run in result sources only, where `policy/no-classes`,
`policy/no-let` and `unicorn/prefer-array-flat` cover them: `noThisInStatic`,
`noImplicitAnyLet` and `noFlatMapIdentity`. Scripts and tooling lose them.
This is an accepted loss: scripts and tooling hold no classes with static
members, `tsc` strict mode reports most implicit `any` from an untyped `let`,
and `flatMap((x) => x)` is a style slip, not a fault.

### JSON and CSS stay with Biome

With Biome's linter fully off, nothing reported a duplicate JSON key or a
duplicate CSS property: a probe with one of each passed `biome check`,
`pnpm lint:policy` and `pnpm lint:styles`. A duplicate key in `package.json`,
a `tsconfig` or a lint config silently keeps the last value. The maintainer
chose to keep Biome's linter for the 30 tracked JSON and JSONC files and the
two CSS files over writing a duplicate-key script, because Oxlint cannot
parse either format and Biome already ships the checks. This is the one
exception to Oxlint owning lint. `scripts/general-lint.test.ts` holds it:
Biome rejects a duplicate JSON, JSONC and CSS key, and reports nothing on a
TypeScript file. The current tree has no finding under the override.

To revert, set `linter.enabled` back to `true` in `biome.json`, replace the
JSON and CSS override with the previous rule blocks and naming override, and
remove the general rules spread and the naming plugin from `oxlint.config.ts`.
Loading
Loading