Skip to content

ci(format): replace Prettier with oxfmt#6236

Open
Slashgear wants to merge 3 commits intomainfrom
use-oxfmt
Open

ci(format): replace Prettier with oxfmt#6236
Slashgear wants to merge 3 commits intomainfrom
use-oxfmt

Conversation

@Slashgear
Copy link
Collaborator

@Slashgear Slashgear commented Feb 27, 2026

Proposal — This PR is submitted for the documentation team's review. It is not meant to be merged as-is without collective validation.


Why oxfmt?

The repo currently uses Prettier to format JSON files. Prettier is a great tool, but it has some limitations in our context:

  • It is slow on large repos (every file is parsed in JS)
  • Its configuration is spread across .prettierrc and .prettierignore
  • It is not designed to be lightweight

oxfmt is an alternative formatter, written in Rust and distributed via npm. It is compatible with Prettier's configuration (same options: singleQuote, trailingComma, semi, etc.) but offers dramatically better performance.

Concrete result: oxfmt formats every file in the repo in a few milliseconds, whereas Prettier takes several seconds.


What this PR changes

Before After
prettier oxfmt
.prettierrc + .prettierignore .oxfmtrc.json
No CI check format job in the GitHub Actions workflow

Modified files

  • package.json — replaces prettier with oxfmt in devDependencies and the format script
  • .oxfmtrc.json — new config file (equivalent to the previous .prettierrc)
  • .prettierrc / .prettierignore — removed
  • .github/workflows/format.yml — adds a format job that installs dependencies and checks formatting on every PR
  • .github/labeler.yml — updates the .prettierrc reference to .oxfmtrc.json

IDE integration

oxfmt ships a drop-in replacement for Prettier's CLI — it registers itself as node_modules/.bin/prettier after pnpm install. This means existing IDE integrations pick it up automatically, with no reconfiguration needed:

  • VS Code: any formatter extension that relies on the local prettier binary (e.g. the official Prettier extension) will transparently use oxfmt instead
  • WebStorm / IntelliJ: same — the built-in "Prettier" formatter setting points to the local binary and will use oxfmt without any change
  • Neovim / other: tools like conform.nvim or null-ls that invoke node_modules/.bin/prettier will work as-is

In short: run pnpm install, and your editor formats with oxfmt automatically.


CI

A format job is added to .github/workflows/format.yml. It runs on every PR and verifies that all files are properly formatted using oxfmt (pnpm format --check). If a file is not formatted, the PR is blocked with a clear diff.


Open questions for the team

  • Do we want to extend formatting to .md / .mdx files in addition to .json?
  • Do we want to enforce the format check as a required status check on main?

@Slashgear Slashgear requested review from a team as code owners February 27, 2026 15:19
@github-actions github-actions bot added type: developer Front Website changes type: dependencies Pull requests that update a dependency file labels Feb 27, 2026
@SamyOubouaziz SamyOubouaziz added the do not merge PR that shouldn't be merged before a specific date (eg release) label Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not merge PR that shouldn't be merged before a specific date (eg release) type: dependencies Pull requests that update a dependency file type: developer Front Website changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants