Skip to content

chore: migrate to Oxfmt#21446

Draft
Dunqing wants to merge 1 commit intovitejs:mainfrom
Dunqing:oxfmt
Draft

chore: migrate to Oxfmt#21446
Dunqing wants to merge 1 commit intovitejs:mainfrom
Dunqing:oxfmt

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: Improve xxx-in-js support 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

transform: perspective(2000px) rotateZ(300deg) rotateX(44deg)
rotateY(39deg) scale(1.4);
transform: perspective(2000px) rotateZ(300deg) rotateX(44deg) rotateY(39deg)
scale(1.4);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

New diff here, I think it is still related to oxc-project/oxc#15180, and probably the most complicated printWidth calculation problem. /cc @leaysgur

Copy link

Choose a reason for hiding this comment

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

You're right, we need Doc -> FormatElement to align this w/ prettier.

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