Skip to content

Migrate linting and formatting to Oxc - #2258

Merged
SawyerHood merged 2 commits into
get-bb:mainfrom
smsunarto:smsunarto/migrate-oxlint-oxfmt
Aug 22, 2026
Merged

Migrate linting and formatting to Oxc#2258
SawyerHood merged 2 commits into
get-bb:mainfrom
smsunarto:smsunarto/migrate-oxlint-oxfmt

Conversation

@smsunarto

Copy link
Copy Markdown
Contributor

Summary

  • replace the root Prettier workflow with Oxfmt while retaining 80-column formatting, existing ignores, and manifest key order
  • migrate the app ESLint rules and Turbo inputs to Oxlint
  • preserve the unsupported no-restricted-syntax policies through a focused local Oxlint plugin and update inline disable directives
  • avoid a bulk formatting rewrite; the repository already has outstanding format differences

Why Oxlint + Oxfmt

The main payoff is materially faster feedback without broadening the change.

Before: 42.2 seconds with ESLint
After: 2.2 seconds with Oxlint, about a 19x improvement.

That shortens the edit-check loop locally and reduces time spent in the lint portion of CI.

The migration also simplifies the direct toolchain:

  • Oxlint replaces ESLint, the TypeScript parser, and the React Hooks plugin.
  • Oxfmt replaces Prettier. Supported TypeScript and React rules run natively, and lint plus format now come from the same Oxc ecosystem rather than separate JavaScript toolchains.

This repository is a good fit for the migration:

  • the existing Node 22.19 minimum satisfies both tools
  • Oxfmt targets Prettier 3.8 compatibility, which is the version being replaced
  • explicit printWidth: 80 and sortPackageJson: false settings preserve current formatting intent and manifest order
  • the existing lint paths, rule severities, ignore patterns, and Turbo caching boundaries remain intact
  • no repository-wide reformat is included, keeping review noise low and blame history useful

The remaining compatibility gaps are bounded and visible. Oxlint does not implement no-restricted-syntax, so the three repository-specific AST policies live in a small local plugin and have been exercised against deliberate violations. The native React analyzer reports additional existing findings; preserve-manual-memoization remains warning-level so this tooling migration does not become unrelated application cleanup. Oxfmt is not byte-identical to Prettier, but with compatibility-focused settings it identifies only 30 additional files beyond the existing baseline.

Taken together, this gives the repository a substantially faster default workflow now, removes direct legacy lint and format dependencies, and keeps the migration reversible and reviewable rather than coupling it to thousands of formatting changes.

Verification

  • pnpm exec turbo run lint --force
  • pnpm exec turbo run typecheck --filter=@bb/app
  • pnpm exec turbo run test --filter=@bb/templates --force
  • pnpm exec oxfmt --check .oxfmtrc.json .oxlintrc.json package.json apps/app/package.json scripts/oxlint-plugin.mjs
  • exercised all three local policy rules against deliberate violations

Formatting baseline

The previous Prettier check reported 459 existing files. Oxfmt reports 487 with compatibility-focused settings, including only 30 files not previously reported by Prettier. This PR intentionally does not reformat the repository.

@SawyerHood
SawyerHood merged commit 24e89be into get-bb:main Aug 22, 2026
12 checks passed
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.

2 participants