Skip to content

build: switch from prettier to 11x faster oxfmt 🚀 - #8382

Open
serhalp wants to merge 3 commits into
mainfrom
serhalp/build/oxfmt
Open

build: switch from prettier to 11x faster oxfmt 🚀#8382
serhalp wants to merge 3 commits into
mainfrom
serhalp/build/oxfmt

Conversation

@serhalp

@serhalp serhalp commented Jul 31, 2026

Copy link
Copy Markdown
Member

Summary

This PR moves this repo's build tooling from prettier to oxfmt. This results in an ~11x speedup of formatting.

On my Apple M3 Pro:

  • prettier --check: 3413 ms median over 5 runs
  • oxfmt --check: 304 ms median over 5 runs

Instead of porting over our exact prettier globs, this also starts formatting all oxfmt default globs, including json, toml, markdown, etc. That accounts for much of the diff in this PR.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Improved error messaging when cloning encounters empty or nonstandard thrown values.
    • Clarified fallback handling in several command-line error messages.
  • Chores

    • Standardized project formatting with oxfmt, replacing Prettier-based workflows.
    • Reformatted configuration, documentation, templates, styles, and test fixtures without changing behavior.
  • Documentation

    • Updated contribution guidance to reflect the new formatting workflow.

Walkthrough

The repository adopts Oxfmt and removes Prettier formatting configuration and dependency usage. Documentation, configuration, source, site, fixtures, tests, and TypeScript declarations are reformatted. Several nullish-coalescing fallback expressions receive explicit grouping, and clone error formatting is adjusted.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: sarahetter

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: replacing Prettier with oxfmt and highlighting the formatting speed improvement.
Description check ✅ Passed The description directly explains the switch from Prettier to oxfmt, the reported speedup, and the resulting formatting scope.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch serhalp/build/oxfmt

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

📊 Benchmark results

Comparing with 6492300

  • Dependency count: 1,166 (no change)
  • Package size: 454 MB ⬆️ 0.00% increase vs. 6492300
  • Number of ts-expect-error directives: 358 (no change)

Comment thread src/commands/types.d.ts
configPath?: string
siteId?: string
get id(): string | undefined
set id(id: string): void

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was invalid TypeScript, obscured by skipLibCheck: true but caught by oxfmt's parser.

// This module is "TypeScript" but contains no actual type annotations, so
// the resulting `.d.ts` file is just useless `any`s.
declare module 'lambda-local' {
declare interface Options {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was invalid TypeScript, obscured by skipLibCheck: true but caught by oxfmt's parser.

- `prettier --check`: 3413 ms median over 5 runs
- `oxfmt --check`: 304 ms median over 5 runs

Instead of porting over our exact prettier globs, this also starts formatting all oxfmt default globs, including json,
toml, markdown, etc.
Comment thread .oxfmtrc.json
"printWidth": 120,
"proseWrap": "always",
"trailingComma": "all",
"sortPackageJson": false,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could turn this one later 😁. I didn't wanna touch too many things here.

Comment thread .oxfmtrc.json
Comment on lines +3 to +7
"semi": false,
"singleQuote": true,
"printWidth": 120,
"proseWrap": "always",
"trailingComma": "all",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to just use defaults, but this matches our Netlify code style

@serhalp
serhalp force-pushed the serhalp/build/oxfmt branch from 5f5564a to bf51b9d Compare July 31, 2026 19:26
@serhalp
serhalp marked this pull request as ready for review July 31, 2026 19:26
@serhalp
serhalp requested review from a team as code owners July 31, 2026 19:26

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/PULL_REQUEST_TEMPLATE.md:
- Around line 15-17: Update the checklist text in the pull request template to
use the apostrophes in “you're” and “that's” instead of escaped backticks, and
hyphenate “incident-related.”

In `@tests/integration/__fixtures__/next-app/app/globals.css`:
- Around line 4-6: Update the --font-mono declaration to satisfy Stylelint’s
value-keyword-case rule by lowercasing the unquoted Menlo and Monaco family
names; preserve the existing font fallback order and values.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0160b946-8078-4bc2-b9c1-9b1dbf7d57d6

📥 Commits

Reviewing files that changed from the base of the PR and between 6492300 and bf51b9d.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (48)
  • .github/.kodiak.toml
  • .github/PULL_REQUEST_TEMPLATE.md
  • .oxfmtrc.json
  • .prettierignore
  • .prettierrc.json
  • CLAUDE.md
  • CODE_OF_CONDUCT.md
  • CONTRIBUTING.md
  • bin/run.js
  • functions-templates/typescript/scheduled-function/{{name}}.mts
  • layout.html
  • package.json
  • renovate.json5
  • site/netlify.toml
  • site/netlify/functions/error-reporting.ts
  • site/scripts/util/generate-command-data.js
  • site/src/content.config.ts
  • site/src/fonts/font-face.css
  • site/src/styles/custom.css
  • src/commands/clone/clone.ts
  • src/commands/types.d.ts
  • src/lib/api.ts
  • src/utils/deploy/hash-fns.ts
  • src/utils/get-repo-data.ts
  • src/utils/live-tunnel.ts
  • src/utils/shell.ts
  • tests/integration/__fixtures__/dev-server-with-header-matching-edge-functions/netlify.toml
  • tests/integration/__fixtures__/dev-server-with-header-matching-edge-functions/public/index.html
  • tests/integration/__fixtures__/hugo-site/layouts/_default/list.html
  • tests/integration/__fixtures__/next-app-without-config/app/globals.css
  • tests/integration/__fixtures__/next-app-without-config/app/page.module.css
  • tests/integration/__fixtures__/next-app/app/globals.css
  • tests/integration/__fixtures__/next-app/app/page.module.css
  • tests/integration/__fixtures__/plugin-changing-publish-dir/netlify.toml
  • tests/integration/commands/dev/redirects.test.ts
  • tests/integration/commands/env/env-get.test.ts
  • tests/integration/commands/env/env-list.test.ts
  • tests/integration/commands/env/env-set.test.ts
  • tests/integration/commands/functions-invoke/functions-invoke.test.ts
  • tests/unit/commands/database/db-migration-pull.test.ts
  • tests/unit/commands/database/db-migrations-reset.test.ts
  • tests/unit/commands/database/db-status.test.ts
  • tests/unit/commands/database/util/api-errors.test.ts
  • types/ascii-table/index.d.ts
  • types/express-logging/index.d.ts
  • types/lambda-local/index.d.ts
  • types/maxstache-stream/index.d.ts
  • types/maxstache/index.d.ts
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • netlify/blueprints (manual)
💤 Files with no reviewable changes (2)
  • .prettierrc.json
  • .prettierignore

Comment thread .github/PULL_REQUEST_TEMPLATE.md
Comment thread tests/integration/__fixtures__/next-app/app/globals.css
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