Skip to content

feat(migrate): Prettier → Oxfmt migration via vp fmt --migrate=prettier - #742

Merged
fengmk2 merged 5 commits into
mainfrom
prettier-migrate
Mar 10, 2026
Merged

feat(migrate): Prettier → Oxfmt migration via vp fmt --migrate=prettier#742
fengmk2 merged 5 commits into
mainfrom
prettier-migrate

Conversation

@fengmk2

Copy link
Copy Markdown
Member

Add Prettier → Oxfmt migration support to vp migrate, following the
same architecture as the existing ESLint → Oxlint migration: Rust shell
script rewriter → NAPI binding → TypeScript orchestration.

  • Rust rewriter rewrites prettiervp fmt, strips Prettier-only
    flags (--write, --cache, --single-quote, --config, --plugin, etc.),
    and converts --list-different/-l → --check
  • Detects all Prettier config files (.prettierrc*, prettier.config.*,
    package.json#prettier) and .prettierignore
  • Removes prettier + prettier-plugin-* dependencies
  • Rewrites scripts in package.json and lint-staged configs
  • Supports both fresh migration and re-migration (already-vite-plus)
  • Includes snap test fixtures for basic, rerun, lint-staged, and
    eslint+prettier combo scenarios

@netlify

netlifyBot commented Mar 9, 2026

Copy link
Copy Markdown

Deploy Preview for viteplus-staging ready!

NameLink
🔨 Latest commit74a2f23
🔍 Latest deploy loghttps://app.netlify.com/projects/viteplus-staging/deploys/69af77bbc669540007e5868d
😎 Deploy Previewhttps://deploy-preview-742--viteplus-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@fengmk2Graphite App

fengmk2 commented Mar 9, 2026

Copy link
Copy Markdown
MemberAuthor

@fengmk2
fengmk2force-pushed the prettier-migrate branch 2 times, most recently from ba4a067 to 9297fc5CompareMarch 9, 2026 13:58
@fengmk2
fengmk2force-pushed the prettier-migrate branch 2 times, most recently from 98e8aa0 to fc66d6dCompareMarch 9, 2026 14:29
@fengmk2
fengmk2force-pushed the prettier-migrate branch 4 times, most recently from 5e41e14 to 71501d6CompareMarch 9, 2026 15:51
@fengmk2
fengmk2 marked this pull request as ready for review March 9, 2026 15:53
@fengmk2fengmk2 added the test: e2e Auto run e2e tests label Mar 9, 2026
@fengmk2
fengmk2force-pushed the prettier-migrate branch 2 times, most recently from 76ebad7 to a3b339cCompareMarch 9, 2026 16:28
@fengmk2
fengmk2 changed the base branch from improve-vp-check to graphite-base/742March 9, 2026 17:04
@graphite-app
graphite-appBot changed the base branch from graphite-base/742 to mainMarch 9, 2026 17:06
@fengmk2
fengmk2force-pushed the prettier-migrate branch 2 times, most recently from 53095a1 to 62bbc40CompareMarch 9, 2026 17:20
Comment threadcrates/vite_migration/src/prettier.rs Outdated
@fengmk2Graphite App

fengmk2 commented Mar 10, 2026

Copy link
Copy Markdown
MemberAuthor

Merge activity

  • Mar 10, 1:29 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Mar 10, 1:30 AM UTC: Graphite rebased this pull request as part of a merge.
  • Mar 10, 1:46 AM UTC: Graphite rebased this pull request as part of a merge.
  • Mar 10, 1:58 AM UTC: Graphite couldn't merge this PR because it was not satisfying all requirements (Failed CI: 'done', 'CLI E2E test (namespace-profile-mac-default)').
  • Mar 10, 2:04 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Mar 10, 2:04 AM UTC: @fengmk2 merged this pull request with Graphite.

Add Prettier → Oxfmt migration support to `vp migrate`, following the
same architecture as the existing ESLint → Oxlint migration: Rust shell
script rewriter → NAPI binding → TypeScript orchestration.
- Rust rewriter rewrites `prettier` → `vp fmt`, strips Prettier-only
flags (--write, --cache, --single-quote, --config, --plugin, etc.),
and converts --list-different/-l → --check
- Detects all Prettier config files (.prettierrc*, prettier.config.*,
package.json#prettier) and .prettierignore
- Removes prettier + prettier-plugin-* dependencies
- Rewrites scripts in package.json and lint-staged configs
- Supports both fresh migration and re-migration (already-vite-plus)
- Includes snap test fixtures for basic, rerun, lint-staged, and
eslint+prettier combo scenarios
…gration
When Prettier config lives in package.json ("prettier" key) rather than a
standalone file, extract it to a temporary .prettierrc.json so that
`vp fmt --migrate=prettier` can read and convert it to .oxfmtrc.json.
Previously the settings were lost because the migration step was skipped
but deletePrettierConfigFiles still removed pkg.prettier.
…prettier rewrite
- Remove --ignore-path from PRETTIER_ONLY_VALUE_FLAGS since vp fmt
supports this flag
- Add --experimental-cli to PRETTIER_ONLY_BOOLEAN_FLAGS so it gets
stripped (fixes vitepress E2E failure)
…rewrite module
prettier.rs and eslint.rs had ~85-90% identical code for shell AST walking,
command renaming, and flag stripping. Extract all shared logic into a new
script_rewrite.rs with a ScriptRewriteConfig struct capturing tool-specific
differences (command name, subcommand, flag lists, flag conversions).
…rewrite
`prettier -c .` now correctly rewrites to `vp fmt --check .` and
`prettier -w .` to `vp fmt .`.
@fengmk2
fengmk2 merged commit c0c8ebd into mainMar 10, 2026
48 of 50 checks passed
@fengmk2
fengmk2 deleted the prettier-migrate branch March 10, 2026 02:04
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test: e2eAuto run e2e tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@fengmk2@cpojer