Skip to content

feat(lint): make Oxlint own all code lint and run every lint gate at pre-commit - #340

Merged
BenSheridanEdwards merged 7 commits into
mainfrom
feat/oxlint-owns-all-lint
Nov 8, 2026
Merged

BenSheridanEdwards merged 7 commits into
mainfrom
feat/oxlint-owns-all-lint

Conversation

@BenSheridanEdwards

@BenSheridanEdwards BenSheridanEdwards commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Why does this feature exist?

Two engines linted this repository, so an agent had to know whether Biome or Oxlint owned each concern, and oxlint.config.ts excluded 47 React Doctor rules because Biome owned them. ADR 0073 already chose Oxlint for lint and Biome for formatting (tasks T16 and T17); this PR carries that out. Biome ran 230 rules on main: 219 at the root, 2 naming rules in package sources, and 9 domain rules that biome rage does not list (6 React domain rules in apps/web and packages/ui, 3 test domain rules under the root package). Pre-commit also ran only half the lint gates: policy lint, the style check, the suppression ban and the architecture gate waited for push, while BulletproofRepository runs them at commit.

Closes #336

What changed?

Above 400 changed lines because moving lint ownership needs the engine config, its tests, the hook and the docs to change together; most of the added lines are the rule table, the naming plugin and their tests.

  • biome.json: linter.enabled is false, with one override that keeps Biome's recommended rules for .json, .jsonc and .css files only, because Oxlint cannot parse them (the maintainer's choice for duplicate JSON keys and CSS properties). Every other file is formatter and import order only.
  • tooling/oxlint-general-rules.ts (new): 170 native Oxlint rules, each naming the Biome rule it replaces, including the React domain rules (react/jsx-key, react/no-array-index-key, react/no-children-prop, react/no-danger, react/no-danger-with-children, react/no-render-return-value) and the test domain rules (jest/no-focused-tests, jest/no-export, jest/no-duplicate-hooks). They match Biome's strength: no-unused-vars checks every argument and caught error, no-sequences rejects parenthesised commas, and no-empty-function, func-style, no-multi-assign, oxc/bad-min-max-func, oxc/approx-constant and oxc/misrefactored-assign-op are on. oxlint.config.ts spreads it into its root rules, loads the typescript, jsx-a11y, oxc and jest plugins, and gives package sources naming/naming-convention and unicorn/filename-case.
  • tooling/oxlint-plugin-naming.js (new): a port of Biome useNamingConvention (strict case, ASCII) covering variables, functions, parameters, object, class and type members, import and export aliases, catch parameters, destructured, defaulted and rest bindings, function and class expression names, index signature parameters, namespaces, types and enum members, with Biome's exceptions. A 60-case test runs real Oxlint and matches Biome 2.5.1 case for case. tooling/oxlint-plugin-policy.js is unchanged.
  • .husky/pre-commit: typecheck, staged Biome, lint:policy, lint:styles, lint:anti-slop, check:suppressions, arch:gate, fallow:audit, secret-scan. scripts/required-gates.mjs names pre-commit as a source for the new steps; docs/required-gates.md is regenerated.
  • scripts/lint-usage.mjs also records lint:policy findings per attempt.
  • packages/ui/src/Button.tsx: sets type="button" before spreading props, so react/button-has-type passes and a caller's type still wins.
  • ADR 0125 (pre-commit runs every lint, style and architecture gate) and ADR 0126 (Oxlint owns all code lint; Biome formats and lints JSON and CSS), which supersedes ADR 0010 and adds an amendment note to ADR 0002. These numbers assume feat: replace the greeting with a to-do reference app #335 (ADR 0123) and feat(lint): add six policy rules mined from nine agent rebuilds #341 (ADR 0124) merge first. TECH_STACK, QUALITY_GATES, CONVENTIONS, PR_QUALITY, the adopt-the-factory skill and two North Star passages now name the Oxlint rules.
  • No new dependency, permission or public API change.

Behavioural Proof (with video and screenshots)

  • Video: Not applicable: lint and hook configuration only; no rendered behaviour changes.
  • Screenshots: Not applicable: the Button renders identical markup and classes.
  • Behaviour tests: scripts/general-lint.test.ts (every new rule, the React and test domain rules, and Biome's JSON and CSS lint, against the real CLIs), tooling/oxlint-plugin-naming.test.ts (60 real Oxlint cases, one per naming selector and exception), scripts/oxlint-rule-set.test.ts, scripts/lint-usage.test.ts (runs the real hook), scripts/required-gates.test.ts.
  • E2E mapping: Not applicable: no user-visible behaviour changed; pnpm e2e passes unchanged.

Verification Summary

  • Head commit: cade095d27567e53fb511fd67e9531afac75f297
  • PRDs checked: None: no PRD covers lint configuration or the UI kit
  • PRD impact: None
  • North Star commit: cade095d27567e53fb511fd67e9531afac75f297
  • Commands run (e.g. pnpm verify, pnpm e2e): pnpm verify, pnpm e2e, the real pre-commit hook on every commit, the real pre-push hook on git push, pnpm check:context, pnpm check:docs.
  • Results: pnpm verify passed (2,977 Jest tests); pnpm e2e passed (15 tests); pre-commit and pre-push passed. The repository has no finding under the 170 general rules, the extended naming rule or the JSON and CSS override. Full pre-commit hook, median of five runs on an M2 Max under load 7 to 10: 12.2 s on a clean tree and 12.5 s with one staged file, of which 3.3 s is the lint-usage recorder in the exit trap. Lint step, median of seven interleaved runs: whole repository 0.95 s before and 0.96 s after; one staged file 1.89 s before and 1.88 s after (ADR 0125 table for every step).
  • Naming plugin against Biome 2.5.1 useNamingConvention on the 26-case benchmark: Biome flags 18; the plugin before this revision agreed on 7 of 26 (it missed all 18 member, alias, pattern, catch, namespace and enum cases and wrongly flagged a declare module interface); it now agrees on 26 of 26, and on 60 of 60 in the visitor suite.
  • Definition of Done (.agents/project/PR_QUALITY.md) satisfied, or each gap named: satisfied, except one proposal for the maintainer, who approves AGENTS.md changes separately: line 18 should read pnpm lint:policy # Oxlint: every code lint rule (general, naming, policy, Tailwind, React hooks, Compiler and Doctor), and the pnpm verify comment should read biome format and JSON/CSS lint → oxlint in place of biome → oxlint.
  • pnpm verify
  • pnpm e2e
  • Behaviour is covered by the E2E map when user-visible behaviour changed.
  • Logic is unit-tested where logic changed.
  • Accessibility considered and verified for interactive/UI changes.
  • The diff follows .agents/project/ARCHITECTURE.md and CONVENTIONS.md; new decisions recorded as ADRs.
  • No gates were bypassed or weakened.
  • Known risks or skipped checks (with reason, risk, and rollback): turning Biome's linter off for code drops 8 rules with no Oxlint equivalent: 7 JavaScript rules listed in ADR 0126 (one, noStringCaseMismatch, is a correctness check) and the HTML rule noDuplicateAttributes on apps/web/index.html. The 25 CSS rules and the JSON duplicate-key rule keep running in Biome. noThisInStatic, noImplicitAnyLet and noFlatMapIdentity now run in result sources only, an accepted loss for scripts and tooling. Four close rules stay off: three need type-aware Oxlint and unicorn/no-useless-undefined is broader than Biome's rule. The enforcement check reports the biome.json change as looser, so it needs the approver's sign-off. Follow-up: the lint-usage recorder re-runs staged Biome and both Oxlint configs in the exit trap (3.3 s per attempt); reusing the hook's own output needs JSON output from each step and a .husky change, so it is left for a separate PR. Rollback: revert this PR; ADR 0126 lists the exact steps.

PRD Behaviours to Review

  • None

PR Proof Law

  • I followed .agents/project/PR_QUALITY.md and .agents/skills/pr-quality-contract/SKILL.md; the PR quality check verifies the proof format.

…e-commit

Biome now only formats and orders imports. Oxlint runs native equivalents
of Biome's lint rules, a naming plugin for package sources, and the React
rules that Biome's React domain never ran here.

Pre-commit now runs policy lint, the style check, the suppression ban and
the architecture gate, as BulletproofRepository does (ADR 0123, ADR 0124).

Refs #336
@github-actions github-actions Bot added confidence: red A required gate is failing or pending, or evidence is unavailable. confidence: amber Required gates passed, with an E2E, PRD, unit coverage or import blast-radius gap. and removed confidence: red A required gate is failing or pending, or evidence is unavailable. labels Nov 8, 2026
PRs #335 and #341 merge first and keep ADRs 0123 and 0124, so this
branch moves its records to 0125 (pre-commit runs every gate) and 0126
(Oxlint owns all lint) and updates every link and comment to match.
Biome's React domain ran in apps/web and packages/ui, and its test domain
ran under the root package. Add react/no-danger, react/no-children-prop
and the jest plugin's no-focused-tests, no-export and no-duplicate-hooks.

Match Biome's strength: no-unused-vars checks every argument and catch
binding, no-sequences rejects parenthesised commas, and no-empty-function,
func-style and no-multi-assign cover the rest of noEmptyBlockStatements,
useArrowFunction and noAssignInExpressions. Enable oxc/bad-min-max-func,
oxc/approx-constant and oxc/misrefactored-assign-op. Drop the
nextjs/google-font-display rule, whose plugin never loaded, and the empty
import plugin. The repository has no findings under the new rules.
The naming plugin covered declarations and parameters only. Add object,
class and type members, import and export aliases, catch parameters,
destructured, defaulted and rest bindings, function and class expression
names, index signature parameters and namespaces. Enum members are
PascalCase only, a top-level function may be UPPERCASE, static and
readonly members may be CONSTANT_CASE, and catch parameters are camelCase.

Mirror Biome's exceptions: quoted keys that are not identifiers, shorthand
destructured properties, named imports kept under their own name,
override members and declarations inside declare module or declare
global. A 60-case Oxlint run asserts each visitor against the names Biome
2.5.1 reports on the same source.
Biome's React domain ran six rules in apps/web and packages/ui and its
test domain ran three rules under the root package, so ADR 0126 now counts
230 Biome rules, maps the domain rules to their Oxlint replacements and
drops the claim that none of the lost rules is a correctness check.

Record that noThisInStatic, noImplicitAnyLet and noFlatMapIdentity now run
in result sources only, and leave duplicate JSON keys and CSS properties
as an open question with two options for the maintainer. State the naming
convention's real coverage in CONVENTIONS, the empty-function and caught
error rules, and the new pre-commit and lint ownership in QUALITY_GATES,
the North Star and an amendment note on ADR 0002.
Oxlint cannot parse JSON or CSS, so with Biome's linter fully off nothing
reported a duplicate JSON key or a duplicate CSS property. The maintainer
chose to keep Biome's recommended rules for .json, .jsonc and .css files
through one biome.json override; every other file stays formatter only.
The staged pre-commit step and pnpm check run the override, and the tree
has no finding under it. Tests seed a duplicate JSON, JSONC and CSS key
and a TypeScript file that Biome must leave alone. ADR 0126, TECH_STACK,
QUALITY_GATES, PR_QUALITY, the North Star and the hook label record the
exception.
@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Enforcement sign-off

Ran at Sunday, the 8th of November, at 11:16 pm on commit cade095.

This PR changes gated enforcement or product intent, so it needs sign-off.

File What changed How it affects
.husky/pre-commit Adds hook commands echo "› biome (format, import order, JSON and CSS lint, staged only)", echo "› oxlint (all lint: general, policy, naming, React, Tailwind and React Doctor rules)", pnpm lint:policy, echo "› style tokens (CSS and index.html on the @repo/ui design tokens)" and 5 more; Removes hook commands echo "› biome (lint + format + imports, staged only)" The hook no longer executes echo "› biome (lint + format + imports, staged only)" or their checks; The hook now executes echo "› biome (format, import order, JSON and CSS lint, staged only)", echo "› oxlint (all lint: general, policy, naming, React, Tailwind and React Doctor rules)", pnpm lint:policy, echo "› style tokens (CSS and index.html on the @repo/ui design tokens)" and 5 more; their exit results participate in the hook's checks
biome.json Changes linter.rules.preset from "recommended" to not set; Changes linter.rules.correctness.noUnusedImports from "error" to not set; Changes linter.rules.correctness.noUnusedVariables from "error" to not set; Changes linter.rules.correctness.useExhaustiveDependencies from "off" to not set; Changes linter.rules.correctness.useHookAtTopLevel from "off" to not set; Changes linter.rules.style.useImportType from "error" to not set; Changes linter.rules.style.useConst from "error" to not set; Changes linter.rules.style.noNonNullAssertion from "error" to not set; Changes linter.rules.style.noIncrementDecrement from "error" to not set; Changes linter.rules.style.useConsistentTypeDefinitions from "error" to not set; Changes linter.rules.suspicious.noExplicitAny from "error" to not set; Changes linter.rules.suspicious.noVar from "error" to not set; Changes linter.rules.suspicious.noEmptyBlockStatements from "error" to not set; Changes overrides[0].includes from "apps/*/src/**" to not set; Changes overrides[0].includes from "packages/*/src/**" to not set; Changes overrides[0].includes from "showcase/*/*/src/**" to not set; Changes overrides[0].linter.rules.style.useNamingConvention.level from "error" to not set; Changes overrides[0].linter.rules.style.useNamingConvention.options.strictCase from true to not set; Changes overrides[0].linter.rules.style.useNamingConvention.options.requireAscii from true to not set; Changes overrides[0].linter.rules.style.useFilenamingConvention.level from "error" to not set; Changes overrides[0].linter.rules.style.useFilenamingConvention.options.strictCase from true to not set; Changes overrides[0].linter.rules.style.useFilenamingConvention.options.requireAscii from true to not set; Changes overrides[0].linter.rules.style.useFilenamingConvention.options.filenameCases from "camelCase" to not set; Changes overrides[0].linter.rules.style.useFilenamingConvention.options.filenameCases from "PascalCase" to not set; Changes overrides[0].linter.rules.style.useFilenamingConvention.options.filenameCases from "export" to not set; Changes overrides[0].includes from not set to "**/*.json"; Changes overrides[0].includes from not set to "**/*.jsonc"; Changes overrides[0].includes from not set to "**/*.css"; Changes overrides[0].linter.enabled from not set to true; Changes overrides[0].linter.rules.preset from not set to "recommended"; Changes linter.enabled from true to false The checker now uses not set for linter.rules.preset instead of "recommended"; Stops configuring linter.rules.correctness.noUnusedImports; inherited settings now decide whether its violations block verification; Stops configuring linter.rules.correctness.noUnusedVariables; inherited settings now decide whether its violations block verification; Stops configuring linter.rules.correctness.useExhaustiveDependencies; inherited settings now decide whether its violations block verification; Stops configuring linter.rules.correctness.useHookAtTopLevel; inherited settings now decide whether its violations block verification; Stops configuring linter.rules.style.useImportType; inherited settings now decide whether its violations block verification; Stops configuring linter.rules.style.useConst; inherited settings now decide whether its violations block verification; Stops configuring linter.rules.style.noNonNullAssertion; inherited settings now decide whether its violations block verification; Stops configuring linter.rules.style.noIncrementDecrement; inherited settings now decide whether its violations block verification; Stops configuring linter.rules.style.useConsistentTypeDefinitions; inherited settings now decide whether its violations block verification; Stops configuring linter.rules.suspicious.noExplicitAny; inherited settings now decide whether its violations block verification; Stops configuring linter.rules.suspicious.noVar; inherited settings now decide whether its violations block verification; Stops configuring linter.rules.suspicious.noEmptyBlockStatements; inherited settings now decide whether its violations block verification; Changes the files checked by overrides[0].includes; Stops configuring overrides[0].linter.rules.style.useNamingConvention.level; inherited settings now decide whether its violations block verification; The checker now uses not set for overrides[0].linter.rules.style.useNamingConvention.options.strictCase instead of true; The checker now uses not set for overrides[0].linter.rules.style.useNamingConvention.options.requireAscii instead of true; Stops configuring overrides[0].linter.rules.style.useFilenamingConvention.level; inherited settings now decide whether its violations block verification; The checker now uses not set for overrides[0].linter.rules.style.useFilenamingConvention.options.strictCase instead of true; The checker now uses not set for overrides[0].linter.rules.style.useFilenamingConvention.options.requireAscii instead of true; The checker now uses not set for overrides[0].linter.rules.style.useFilenamingConvention.options.filenameCases instead of "camelCase"; The checker now uses not set for overrides[0].linter.rules.style.useFilenamingConvention.options.filenameCases instead of "PascalCase"; The checker now uses not set for overrides[0].linter.rules.style.useFilenamingConvention.options.filenameCases instead of "export"; The checker now uses true for overrides[0].linter.enabled instead of not set; The checker now uses "recommended" for overrides[0].linter.rules.preset instead of not set; Looser: Biome stops linting covered source files
docs/NORTH_STAR.md Rewrites the 2 sections 1. Lint beats instructions, 9. Declarative over imperative; Adds product requirements formatting, every lint, style and suppression rule, the architecture gate, changed-file Fallow complexity and, secrets; pre-push requires freshly fetched, owns formatting, import order and JSON and CSS lint; Oxlint owns every other lint rule, including general, policy,, hooks, Compiler and React Doctor rules; the React Doctor CLI owns project checks. and 2 more; Removes product requirements formatting/lint, changed-file Fallow complexity and secrets; pre-push requires freshly fetched, owns format and general lint; Oxlint owns policy, hooks, Compiler and React Doctor rules; the React Doctor CLI owns project checks., value; build arrays and objects with 'map', 'flatMap' and 'Object.fromEntries'. Biome rejects accumulating, spread. Biome 'style/useConst' and React Hooks immutability, globals and purity rules cover single-assignment Product intent now includes formatting, every lint, style and suppression rule, the architecture gate, changed-file Fallow complexity and, secrets; pre-push requires freshly fetched, owns formatting, import order and JSON and CSS lint; Oxlint owns every other lint rule, including general, policy,, hooks, Compiler and React Doctor rules; the React Doctor CLI owns project checks. and 2 more instead of formatting/lint, changed-file Fallow complexity and secrets; pre-push requires freshly fetched, owns format and general lint; Oxlint owns policy, hooks, Compiler and React Doctor rules; the React Doctor CLI owns project checks., value; build arrays and objects with 'map', 'flatMap' and 'Object.fromEntries'. Biome rejects accumulating, spread. Biome 'style/useConst' and React Hooks immutability, globals and purity rules cover single-assignment; implementation and behaviour tests must follow the revised intent
oxlint.config.ts Turns on the lint rule at error: naming/naming-convention; Changes lint option files (4) from not set to "['{apps,packages}/*/src/**', 'showcase/*/*/src/**']" Changes lint coverage or inherited configuration: ignore and exclude patterns bypass checking; files and includes patterns select checked paths; extends loads the named rule configuration; The named lint rules run at the stated severity; warnings and errors block verification

@BenSheridanEdwards: tick to approve.

  • Approve these enforcement changes at cade095 ticked by Ben Sheridan Edwards at Sunday, the 8th of November, at 11:16 pm (@BenSheridanEdwards)

@BenSheridanEdwards BenSheridanEdwards changed the title feat(lint): make Oxlint the only linter and run every lint gate at pre-commit feat(lint): make Oxlint own all code lint and run every lint gate at pre-commit Nov 8, 2026
@github-actions github-actions Bot added confidence: red A required gate is failing or pending, or evidence is unavailable. confidence: amber Required gates passed, with an E2E, PRD, unit coverage or import blast-radius gap. and removed confidence: amber Required gates passed, with an E2E, PRD, unit coverage or import blast-radius gap. confidence: red A required gate is failing or pending, or evidence is unavailable. labels Nov 8, 2026
BenSheridanEdwards added a commit that referenced this pull request Nov 8, 2026
* feat(test): split present() from unwrap() for outcomes

present(value) now fails a test on null or undefined only, and the new
unwrap(outcome) takes only a success or failure outcome and fails the test
with the failure. The api test unwraps its outcomes with unwrap(), a unit
test holds the E2E fixtures copy of present() to the Jest global's
behaviour, and policy/test-unwraps-values names the helper that fits.

Refs #337

* fix(types): show the test globals to test files alone

The web and api programs now exclude test files, and two test programs,
tsconfig.test.json and tsconfig.api.test.json, check them with the
present() and unwrap() declarations, so a production module that calls
either fails pnpm typecheck with TS2304. The showcase inclusion test
seeds that call in a web and an api module to prove it.

Refs #337

* fix(lint): resolve query reads through scope in one-status-from-hooks

one-status-from-hooks now counts only roots bound by a const to useQuery,
useSuspenseQuery or useInfiniteQuery, reads the status inside a lookup
such as LIST_STATES[list.status] (r7 and r8), and leaves error and
isFetching out of the count. It and keep-rejections resolve each name
through the scope chain instead of a file-wide map, so a same-named
binding in another function no longer decides the result. Fixtures cover
r7, r8, the four reviewed false positives and shadowed names.

Refs #337

* fix(lint): match only limits written as counts in message-uses-its-limit

The rule now considers module constants named as a limit (MAX, MIN,
LIMIT, LENGTH and their kin, in snake or camel case) and matches the
number only when a word follows it, in plain or grouped form such as
1,000. It skips JSX attribute values and import sources. Fixtures cover
a grouped count, JSX text, and the reviewed false positives: COLUMNS with
gap-10, ICON_SIZE with a viewBox, MAX_PERCENT with 100%, PORT in a URL
and PAGE_SIZE beside "Ages 20 and over".

Refs #337

* fix(lint): narrow the two test rules to the shapes they target

test-unwraps-values reports an x.ok ternary only when its other branch
reads x.value, so response.ok ? 'passed' : 'failed' passes.
test-imports-the-type anchors its export pattern to the start of a line,
so text in strings and comments no longer counts, and scans each folder
once until a module in it changes. Fixtures and a unit test cover both.

Refs #337

* refactor(lint): rename the re-export rule to reexport-only-from-index

The rule bans every re-export in a slice module, not only types, so its
name now says that. It also stops exempting a nested index file: only
the slice's own index.ts is a public surface, as no-restricted-imports
already holds, so src/routes/todos/components/index.ts fails too. No
rebuild had a nested barrel. The ADR, conventions and architecture rows
use the new name.

Refs #337

* docs(lint): name the sanctioned way to ignore a rejection in ADR 0124

keep-rejections now tells the reader to settle a promise with
Promise.allSettled when ignoring its failure is intended, and the ADR and
conventions show both forms, which pass lint:policy, lint:anti-slop and
Biome. The ADR drops the zero false-positive claim and the note about
pre-commit, which PR #340 changes, and records r7 and r8 and the five
shapes review found.

Refs #337
@BenSheridanEdwards
BenSheridanEdwards merged commit 87fb23e into main Nov 8, 2026
21 of 23 checks passed
BenSheridanEdwards added a commit that referenced this pull request Nov 8, 2026
Bring in #340 (Oxlint owns all code lint; ADRs 0125 and 0126).

Conflicts resolved:
- oxlint.config.ts: keep the E2E test-unwraps-values override and add
  the naming and file-name override from main. The six rebuild rules
  stay in the result-root override; generalRules spreads into the root.
- scripts/oxlint-policy.test.ts: take main's policyOnly filter and keep
  the branch's slop-* fixture prefix.
- tooling/trial/inclusion.test.ts: take main's Oxlint file-name test,
  seeded under routes/todos.
- CONVENTIONS.md: take main's naming rows with the to-do examples.
- PR_QUALITY.md: keep six typecheck programs; take main's lint wording.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

confidence: amber Required gates passed, with an E2E, PRD, unit coverage or import blast-radius gap.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lint: Oxlint owns all linting, Biome only formats, and pre-commit runs every lint gate

1 participant