Skip to content

fix(formatter): return original classes when there are no tailwindcss classes sort callback#17689

Merged
graphite-app[bot] merged 1 commit intomainfrom
formatter-tailwindcss-empty-classses
Jan 6, 2026
Merged

fix(formatter): return original classes when there are no tailwindcss classes sort callback#17689
graphite-app[bot] merged 1 commit intomainfrom
formatter-tailwindcss-empty-classses

Conversation

@Dunqing
Copy link
Member

@Dunqing Dunqing commented Jan 6, 2026

close: #17690

Return original classes if there is no sort tailwindcss classes callback, that it is happens in VSCode, it can read experimentalTailwindcss configuration, but no tailwindcss callback setup, as LSP does not support it yet

I don't add a test for this, as it seems there are no places where I can write a test for it 😅. But luckily, the changes are obvious.

@github-actions github-actions bot added A-formatter Area - Formatter C-bug Category - Bug labels Jan 6, 2026
Copy link
Member Author

Dunqing commented Jan 6, 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.

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 6, 2026

CodSpeed Performance Report

Merging #17689 will not alter performance

Comparing formatter-tailwindcss-empty-classses (fbae5ce) with main (1872af4)1

Summary

✅ 38 untouched
⏩ 7 skipped2

Footnotes

  1. No successful run was found on main (120a27c) during the generation of this report, so 1872af4 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 7 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@Dunqing Dunqing marked this pull request as ready for review January 6, 2026 02:44
@Dunqing Dunqing requested review from Copilot and leaysgur January 6, 2026 02:44
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 fixes a bug in the formatter where Tailwind CSS classes were being replaced with an empty vector when no sort callback was provided, instead of preserving the original classes.

Key Changes:

  • Changed sort_tailwind_classes return type from Option<Vec<String>> to Vec<String>
  • Updated implementation to return original classes when no callback is set, instead of None
  • Removed .unwrap_or_default() call at the usage site

Reviewed changes

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

File Description
crates/oxc_formatter/src/external_formatter.rs Modified sort_tailwind_classes to return the original classes when no callback is set, instead of returning None
crates/oxc_formatter/src/formatter/mod.rs Updated caller to use the new return type without .unwrap_or_default()

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nrjdalal
Copy link

nrjdalal commented Jan 6, 2026

mergeeeee it 🚀

@leaysgur leaysgur added the 0-merge Merge with Graphite Merge Queue label Jan 6, 2026
Copy link
Member

leaysgur commented Jan 6, 2026

Merge activity

… classes sort callback (#17689)

close: #17690

Return original classes if there is no sort tailwindcss classes callback, that it is happens in VSCode, it can read `experimentalTailwindcss` configuration, but no tailwindcss callback setup, as LSP does not support it yet

I don't add a test for this, as it seems there are no places where I can write a test for it 😅. But luckily, the changes are obvious.
@graphite-app graphite-app bot force-pushed the formatter-tailwindcss-empty-classses branch from fbae5ce to 6f65901 Compare January 6, 2026 04:00
@graphite-app graphite-app bot merged commit 6f65901 into main Jan 6, 2026
20 checks passed
@graphite-app graphite-app bot deleted the formatter-tailwindcss-empty-classses branch January 6, 2026 04:06
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jan 6, 2026
Dunqing added a commit that referenced this pull request Jan 6, 2026
# Oxlint

# Oxfmt
### 🚀 Features

- a19cc93 oxfmt: Add debug logging to oxfmt LSP to troubleshoot resolved
options at runtime (#17695) (Nicholas Rayburn)

### 🐛 Bug Fixes

- 3b4aced formatter: Should not treat multi-type arguments of
TSTypeReference as a complex type (#17708) (Dunqing)
- dcfdd41 formatter: Should not set up tailwindcss callback when no
tailwindcss configuration is set (#17696) (Dunqing)
- 6f65901 formatter: Return original classes when there are no
tailwindcss classes sort callback (#17689) (Dunqing)

### ⚡ Performance

- c6a99fd formatter: Don't call `sort_tailwind_classes` if no classes
need to be sorted (#17698) (Dunqing)

Co-authored-by: Dunqing <29533304+Dunqing@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-formatter Area - Formatter C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

oxfmt with experimentalTailwindcss is removing tailwind classnames

4 participants