Migrate from Prettier to oxfmt - #768
Open
veksa wants to merge 1 commit into
Open
Conversation
✅ Deploy Preview for reselect-docs canceled.
|
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This replaces Prettier with oxfmt, the formatter from the Oxc project. oxfmt is Prettier-compatible but written in Rust, so it's dramatically faster and lets us drop Prettier from the dependency tree.
What changed
The config was generated with oxfmt's built-in
--migrate=prettier, so.oxfmtrc.jsoncarries over every setting from the old.prettierrc.jsonone to one — no semicolons, single quotes, two-space indent, no trailing commas, avoid arrow parens. The migration also picked up thatprintWidthwasn't set and pinned it to Prettier's default of 80 (oxfmt's own default is 100), which keeps the wrapping identical instead of reflowing the whole codebase. The old.prettierrc.jsonis gone,prettieris swapped foroxfmtin devDependencies, and theformatscript now runsoxfmt src test. There was no.prettierignore, and oxfmt reads.gitignoreon its own, so nothing was lost there.I also added a
format:checkscript and wired it into CI right after the lint step. Formatting was never actually enforced before — Prettier only ran locally in--writemode — so this closes that gap and stops unformatted code from slipping in.Reformatting
oxfmt is close enough to the current Prettier output that only four files in
srcchange, and those are the usual Prettier v2 to v3 differences in how nested ternaries and broken-up call arguments are indented (the repo was still onprettier@2). Running the formatter is idempotent afterwards.One spot needed a manual touch: in
src/types.tsthere were two line comments sitting betweenextendsand the function type, and oxfmt collapsed them onto one line and flipped their order, which turned them into nonsense. I moved the comment inside the parentheses as a leading comment on the parameter — a position the formatter handles cleanly — without changing the type itself.