feat(oxfmt): Support oxfmt --migrate prettier (JS side)#16773
feat(oxfmt): Support oxfmt --migrate prettier (JS side)#16773graphite-app[bot] merged 1 commit intomainfrom
oxfmt --migrate prettier (JS side)#16773Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
The migration flow has a correctness issue where resolveConfigFile() and resolveConfig() resolve against different targets, which can migrate a different config than the one detected. The Prettier-to-oxfmt mapping currently copies arbitrary Prettier keys into .oxfmtrc.json, which risks generating misleading/unsupported configuration. Finally, .prettierignore parsing swallows all errors, making migration failures hard to diagnose.
Summary of changes
Summary
This PR adds JS-side support for oxfmt --migrate prettier and refactors migration helpers.
- CLI routing:
apps/oxfmt/src-js/cli.tsnow dispatches both--initand--migrate prettiermodes via./migration/index.js. - Migration entrypoint: new barrel file
apps/oxfmt/src-js/migration/index.tsre-exportsrunInitandrunMigratePrettier. - Shared migration utilities: new
apps/oxfmt/src-js/migration/shared.tscentralizes:.oxfmtrcexistence checks (hasOxfmtrcFile)- schema discovery (
hasSchemaFile) - blank config creation (
createBlankOxfmtrcFile) - config persistence (
saveOxfmtrcFile) - consistent error exit behavior (
exitWithError)
--initrefactor:apps/oxfmt/src-js/migration/init.tsnow uses shared helpers instead of inline FS logic.- Prettier migration: new
apps/oxfmt/src-js/migration/migrate-prettier.tsresolves a Prettier config (and.prettierignore) and writes an.oxfmtrc.json, warning on unsupported/partial options.
76109c0 to
5127f76
Compare
oxfmt --migrate (JS side)
Review for PR #16773Overall impressionsSolid foundation for Major Feedback
Minor suggestions
SummaryGreat progress and well-factored utilities with just a few migration correctness/safety changes advised before releasing widely. Please reference detailed suggestions in the inline bots' comments for practical code-level examples. Inline feedback (see PR for context and details):
Would recommend addressing the above for more predictable and robust migrations. |
oxfmt --migrate (JS side)oxfmt --migrate prettier (JS side)
0171ccf to
93019f7
Compare
5127f76 to
270f454
Compare
Merge activity
|
93019f7 to
2b9c3fe
Compare
270f454 to
d4c0bb7
Compare

Fixes #15849 , closes #16736
Tests and cosmetic changes are planned in next PR.