Skip to content

Conversation

@Dunqing
Copy link
Contributor

@Dunqing Dunqing commented Jan 20, 2026

Migrate the formatter to Oxfmt. The last blocker is overrides config, which is already supported in oxc-project/oxc#18068 and released in oxfmt@0.25.0 (the latest is oxfmt@0.26.0).

Following the changes I made for migrating:

  1. Renamed .prettierrc.json to .oxfmtrc.json.
  2. Set printWidth: 80 (Oxfmt defaults to 100).
  3. Turn off experimentalSortPackageJson (Avoid large diffs; there are over 200 packages.json files in the codebase).
  4. Merge .prettierignore into .oxfmtrc.json, which is now listed in the ignorePatterns field.
  5. Change the Prettier command to the Oxfmt command
  6. Rename Prettier word to Oxfmt in CONTRIBUTING.md

Diffs:

  1. netlify.toml differences are expected, as Oxfmt has built-in support for TOML, which formats it like this.
  2. packages/create-vite/template-lit-ts/src/my-element.ts and packages/create-vite/template-lit/src/my-element.js are unexpected differences. I checked into Prettier, and there is no extra indent for the empty line. Maybe it is caused by the embedding formatting still being incomplete. See oxfmt: embedded formatting full support (aka xxx-in-js) oxc-project/oxc#15180

Besides the above discrepancies, when I turned on experimentalSortPackageJson, I received the following error.

> oxfmt
  × Failed to sort package.json: /Users/qing/p/github/vite/playground/resolve/utf8-bom-package/package.json
  │ expected value at line 1 column 1

But it is weird, as it works in the Oxc VSCode extension.

@leaysgur cc

@leaysgur
Copy link

NOTE:

× Failed to sort package.json: /Users/qing/p/github/vite/playground/resolve/utf8-bom-package/package.json
│ expected value at line 1 column 1

This error occurs because sort-package-json does not handle BOM.

Currently working on a fix. 👉🏻 oxc-project/sort-package-json#39

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

Labels

None yet

2 participants