Skip to content

test(oxfmt): Add js-in-xxx prettier conformance#19563

Merged
graphite-app[bot] merged 1 commit intomainfrom
02-20-test_oxfmt_add_js-in-xxx_prettier_conformance
Feb 24, 2026
Merged

test(oxfmt): Add js-in-xxx prettier conformance#19563
graphite-app[bot] merged 1 commit intomainfrom
02-20-test_oxfmt_add_js-in-xxx_prettier_conformance

Conversation

@leaysgur
Copy link
Member

@leaysgur leaysgur commented Feb 20, 2026

Add conformance test assert(oxfmt(vueFile) === prettier(vueFile)).

Currently, fixtures are downloaded individually and are not executed in CI.

It might have been better to change CI to download prettier's submodules and refer to them?, but for now.

@github-actions github-actions bot added A-cli Area - CLI A-formatter Area - Formatter C-test Category - Testing. Code is missing test cases, or a PR is adding them labels Feb 20, 2026
Copy link
Member Author

leaysgur commented Feb 20, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

@leaysgur leaysgur force-pushed the 02-20-test_oxfmt_add_js-in-xxx_prettier_conformance branch 2 times, most recently from fb777c3 to 0b4bf60 Compare February 20, 2026 04:53
@leaysgur leaysgur marked this pull request as ready for review February 20, 2026 05:15
@leaysgur leaysgur force-pushed the 02-20-test_oxfmt_add_js-in-xxx_prettier_conformance branch from 0b4bf60 to 75d48b7 Compare February 20, 2026 05:18
@leaysgur leaysgur requested a review from Copilot February 20, 2026 05:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds conformance tests to verify that oxfmt's output matches Prettier's output for Vue files (and prepares infrastructure for other file types). The tests download Prettier's official test fixtures from their repository and compare formatting results between oxfmt and Prettier.

Changes:

  • Added a new conformance test suite that compares oxfmt formatting output with Prettier's output for Vue files
  • Added a script to download Prettier test fixtures from their repository using degit
  • Added degit as a dev dependency to enable downloading fixtures
  • Updated .gitignore to exclude downloaded fixtures from version control

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pnpm-lock.yaml Adds degit dependency lock entry
apps/oxfmt/test/api/js-in-xxx-conformance.test.ts New conformance test suite that collects Vue fixtures and compares oxfmt vs prettier formatting with multiple option configurations
apps/oxfmt/scripts/download-prettier-fixtures.js Script to download prettier test fixtures using degit from the prettier repository
apps/oxfmt/package.json Adds download-prettier-fixtures script and degit dev dependency
apps/oxfmt/.gitignore Excludes prettier-fixtures directory from git
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

@leaysgur leaysgur requested a review from Dunqing February 20, 2026 05:33
@leaysgur leaysgur force-pushed the 02-18-feat_formatter_oxfmt_support_js-in-vue_partially_ branch from 291d96b to 7fe1a05 Compare February 20, 2026 08:01
@leaysgur leaysgur force-pushed the 02-20-test_oxfmt_add_js-in-xxx_prettier_conformance branch 2 times, most recently from d6fa641 to cf1530c Compare February 24, 2026 00:37
@leaysgur leaysgur force-pushed the 02-18-feat_formatter_oxfmt_support_js-in-vue_partially_ branch from 7fe1a05 to 3b495e4 Compare February 24, 2026 00:37
@Dunqing Dunqing added the 0-merge Merge with Graphite Merge Queue label Feb 24, 2026
Copy link
Member

Dunqing commented Feb 24, 2026

Merge activity

Add conformance test `assert(oxfmt(vueFile) === prettier(vueFile))`.

Currently, fixtures are downloaded individually and are not executed in CI.

It might have been better to change CI to download prettier's submodules and refer to them?, but for now.
graphite-app bot pushed a commit that referenced this pull request Feb 24, 2026
### Overview

Part of #16608

This PR applies `oxc_formatter` to the js-in-vue section.

However, it is not complete and is only applied to the following parts within js-in-vue:

- `script` block
  - and `generic="..."`
- `v-for` LHS
- `v-slot`

In the `script` block, `external_callback` is used like a regular JS file, but it isn't for others.

TL;DR: Now you can use sort-imports for Vue files.

### Review points

The points I'd like to ask your review are the following:

- Addition of `format_node()` to `oxc_formatter`
  - Made it possible to process any type that implements `Format`, not just `Program`
- The implementation of `js-in-vue` fragment was separated as much as possible to avoid impacting existing code
- `oxc_formatter` IR to prettier `Doc`

### TODOs

- [x] Planning
- [x] Implementation
- [x] Check benchmark
- [x] Check coverage
- [x] Understand & refactor
  - [x] oxfmt: JS side
  - [x] oxfmt: Rust side
  - [x] oxfmt: to_doc.rs
  - [x] oxc_formatter: fragment_format
- [x] Check benchmark again
- [x] Check coverage again
- [x] Check ecosystem-ci
- [x] Tests 👉🏻 #19563
@graphite-app graphite-app bot force-pushed the 02-18-feat_formatter_oxfmt_support_js-in-vue_partially_ branch from 3b495e4 to 035933c Compare February 24, 2026 10:17
@graphite-app graphite-app bot force-pushed the 02-20-test_oxfmt_add_js-in-xxx_prettier_conformance branch from cf1530c to 4ce37b0 Compare February 24, 2026 10:18
Base automatically changed from 02-18-feat_formatter_oxfmt_support_js-in-vue_partially_ to main February 24, 2026 10:24
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Feb 24, 2026
@graphite-app graphite-app bot merged commit 4ce37b0 into main Feb 24, 2026
20 checks passed
@graphite-app graphite-app bot deleted the 02-20-test_oxfmt_add_js-in-xxx_prettier_conformance branch February 24, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-formatter Area - Formatter C-test Category - Testing. Code is missing test cases, or a PR is adding them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants