fix(formatter): return original classes when there are no tailwindcss classes sort callback#17689
Conversation
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. |
CodSpeed Performance ReportMerging #17689 will not alter performanceComparing Summary
Footnotes
|
There was a problem hiding this comment.
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_classesreturn type fromOption<Vec<String>>toVec<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.
|
mergeeeee it 🚀 |
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.
fbae5ce to
6f65901
Compare
# 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>

close: #17690
Return original classes if there is no sort tailwindcss classes callback, that it is happens in VSCode, it can read
experimentalTailwindcssconfiguration, but no tailwindcss callback setup, as LSP does not support it yetI 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.