Skip to content

feat(devops): add Oxfmt alongside Prettier for incremental migration#3871

Draft
wraith4081 wants to merge 1 commit intoopenfrontio:mainfrom
wraith4081:feat/oxfmt-migration
Draft

feat(devops): add Oxfmt alongside Prettier for incremental migration#3871
wraith4081 wants to merge 1 commit intoopenfrontio:mainfrom
wraith4081:feat/oxfmt-migration

Conversation

@wraith4081
Copy link
Copy Markdown
Contributor

@wraith4081 wraith4081 commented May 6, 2026

Description:

Adds Oxfmt to the project without removing Prettier yet.

This is intended as a first migration step: Oxfmt is now available through opt-in local scripts, while Prettier stays as the default formatter to keep the existing formatting workflow unchanged.

Changes

  • Added oxfmt.
  • Added .oxfmtrc.json.
  • Added separate scripts for running Oxfmt and Oxfmt format checks.
  • Kept npm run format on Prettier for now.
  • Kept Prettier, prettier-plugin-organize-imports, and prettier-plugin-sh in place.
  • Updated docs to mention the Oxfmt + Prettier transition.

Why not replace Prettier yet?

Oxfmt looks promising and is much faster, but this PR intentionally avoids a large mechanical reformat.

A full Oxfmt switch would touch hundreds of files, which would make this tooling PR harder to review. Prettier also still handles current repo behavior that we do not want to change in this first step, including shell formatting and import organization.

Because of that, this PR keeps Prettier as the default formatter and adds Oxfmt as an opt-in formatter first.

Current Oxfmt config

Oxfmt is configured conservatively so it stays close to the current Prettier setup.

Enabled config:

  • printWidth: 80
  • sortImports: false
  • sortPackageJson: false

Import sorting and package.json sorting are disabled for now to avoid unrelated formatting churn.

Notes

  • npm run format still runs Prettier.
  • npm run format:oxfmt runs Oxfmt.
  • npm run format:oxfmt:check checks formatting with Oxfmt.
  • CI and lint-staged are intentionally unchanged in this first PR.
  • A follow-up PR can do the mechanical Oxfmt reformat, then another PR can switch CI and lint-staged.

Local timing

Initial local timings:

  • Prettier: 13.455s
  • Oxfmt: 1.491s wall time (997ms reported by Oxfmt over 734 files)

This is a strong signal that Oxfmt is worth continuing to migrate toward, but this PR keeps the rollout incremental instead of changing the whole formatting pipeline at once. (Ryzen 9 7940HS, 8x2 Thread, 40GB 4800MT/s DDR5, 990 Pro, Node v25.8.1)

Prettier Oxfmt
image image

Please complete the following:

  • I have added screenshots for all UI updates
  • I process any text displayed to the user through translateText() and I've added it to the en.json file
  • I have added relevant tests to the test directory
  • I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced

Please put your Discord username so you can be contacted if a bug or regression is found:

wraith4081

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

Walkthrough

This PR introduces Oxfmt as an opt-in incremental code formatter alongside the default Prettier setup. It adds an oxfmt configuration file, multiple npm format scripts, a new devDependency, and updates documentation to guide developers on both formatter options during the migration.

Changes

Oxfmt Formatter Migration

Layer / File(s) Summary
Configuration
.oxfmtrc.json
New oxfmt configuration file specifying printWidth 80, sortImports false, and sortPackageJson false.
Scripts & Dependency
package.json
Added format (default to Prettier), format:prettier, format:oxfmt, and format:oxfmt:check scripts; added oxfmt ^0.48.0 devDependency.
Developer Documentation
CLAUDE.md, CONTRIBUTING.md, map-generator/README.md
Updated guides to explain both formatter options, mark Oxfmt as opt-in during migration, and provide per-file formatting instructions for developers.

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

Formatter friends in balance dance,
Prettier leads, but Oxfmt's chance—
Two tools in sync, a gentle way,
To migrate slowly, day by day. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding Oxfmt as an opt-in formatter alongside Prettier for incremental migration, matching the changeset's core objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Description check ✅ Passed The pull request description clearly relates to the changeset, detailing the addition of Oxfmt as an opt-in formatter alongside Prettier, with comprehensive explanations of changes and rationale.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@socket-security
Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​oxfmt@​0.48.0901008995100

View full report

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
package.json (2)

19-20: ⚡ Quick win

Consider adding --disable-nested-config to the oxfmt scripts for a small performance gain.

Oxfmt supports nested config lookup per file; passing --disable-nested-config makes it resolve the config once instead of per file, which is faster. Since this project has a single root-level .oxfmtrc.json with no package-level overrides, this flag is safe to add.

⚡ Proposed change
-    "format:oxfmt": "oxfmt",
-    "format:oxfmt:check": "oxfmt --check",
+    "format:oxfmt": "oxfmt --disable-nested-config",
+    "format:oxfmt:check": "oxfmt --check --disable-nested-config",
🤖 Prompt for 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.

In `@package.json` around lines 19 - 20, The oxfmt NPM scripts "format:oxfmt" and
"format:oxfmt:check" perform per-file nested config lookup which is unnecessary
for this repo; update both script values in package.json to append the flag
--disable-nested-config so oxfmt resolves config once (e.g., change the
"format:oxfmt" and "format:oxfmt:check" script strings to include
--disable-nested-config).

70-70: 💤 Low value

^0.48.0 will receive only patch-level updates for this 0.x dependency.

The latest published version is 0.48.0, and there are already 50 versions in the registry, reflecting a very fast release cadence. With a 0.x major, npm's ^ range resolves to >=0.48.0 <0.49.0, so every minor bump (e.g., 0.49.0) will require a manual dependency update. This is intentionally conservative for an opt-in tool, but worth being aware of — a ~0.48.0 (same effective range) or a periodic version bump strategy may be preferable once the migration is complete.

🤖 Prompt for 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.

In `@package.json` at line 70, The package.json currently pins the oxfmt
dependency using the caret range "oxfmt": "^0.48.0", which for 0.x releases only
allows patch updates and will not pick up 0.49.0+ minors; change the version
specifier to a tilde range "oxfmt": "~0.48.0" (or another agreed range/policy)
to make it explicit that you want the same effective update behavior but clearer
intent, or add a comment/maintenance note to the repo stating you will perform
periodic manual bumps of "oxfmt" to follow its rapid 0.x release cadence; update
the package.json entry for "oxfmt" accordingly and ensure any CI or dependency
update tooling is aligned with that policy.
🤖 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.

Nitpick comments:
In `@package.json`:
- Around line 19-20: The oxfmt NPM scripts "format:oxfmt" and
"format:oxfmt:check" perform per-file nested config lookup which is unnecessary
for this repo; update both script values in package.json to append the flag
--disable-nested-config so oxfmt resolves config once (e.g., change the
"format:oxfmt" and "format:oxfmt:check" script strings to include
--disable-nested-config).
- Line 70: The package.json currently pins the oxfmt dependency using the caret
range "oxfmt": "^0.48.0", which for 0.x releases only allows patch updates and
will not pick up 0.49.0+ minors; change the version specifier to a tilde range
"oxfmt": "~0.48.0" (or another agreed range/policy) to make it explicit that you
want the same effective update behavior but clearer intent, or add a
comment/maintenance note to the repo stating you will perform periodic manual
bumps of "oxfmt" to follow its rapid 0.x release cadence; update the
package.json entry for "oxfmt" accordingly and ensure any CI or dependency
update tooling is aligned with that policy.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 37cbd324-d5de-4ed4-8091-6949d636f337

📥 Commits

Reviewing files that changed from the base of the PR and between 6afedd8 and 87f39f8.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (5)
  • .oxfmtrc.json
  • CLAUDE.md
  • CONTRIBUTING.md
  • map-generator/README.md
  • package.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant