You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Canonicalization: print utilities named @ without a - after the @ - #20608
When a plugin registers a utility named @, @px-4 can also be parsed as root @ with value px-4. printCandidate always put a - between root and value, so that reading printed as @-px-4, and canonicalization returned it as the "canonical" form. That class doesn't compile (and @--foo-4 became @---foo-4, which sets a different property).
This skips the - for a utility named @, the same way printVariant already does for the @ variant. Now both readings print back as the original class and nothing gets rewritten.
Added a regression test in canonicalize-candidates.test.ts using the plugin from the issue. It fails on main (['@-px-4', '@---foo-4']) and passes with this change. Ran pnpm vitest run in packages/tailwindcss, all tests pass.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Walkthrough
printCandidate no longer inserts a separator hyphen after the @ functional root when printing named values. A regression test checks that canonicalization retains @px-4 and @--foo-4. The Unreleased changelog records this fix.
Priority: ➖ Normal
Severity of issue fixed: Medium
Merge Risk:⚪ Minimal · up to 2c206
No actionable issue remains from this review; the change is ready for normal merge checks.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title clearly and concisely describes the main change: canonicalization no longer inserts a separator after a utility root named @.
Description check
The description directly explains the bug, the implementation change, the regression test, the expected results, and the reported test execution.
Linked Issues check
The PR addresses [#20607]. printCandidate now omits the separator - when the functional utility root is @. The supplied regression test covers @px-4 and @--foo-4 with utilities named @px a…
Out of Scope Changes check
The source change, regression test, and one-line changelog entry all support the linked canonicalization fix. No unrelated change is identified in the supplied PR summary.
Full details: Linked Issues check
Explanation
The PR addresses [#20607]. printCandidate now omits the separator - when the functional utility root is @. The supplied regression test covers @px-4 and @--foo-4 with utilities named @px and @. The reported test result confirms that canonicalization preserves both spellings. The change also prevents the reported @mt-16/24 rewrite because root-@ candidates now print without an inserted separator.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a plugin registers a utility named
@,@px-4can also be parsed as root@with valuepx-4.printCandidatealways put a-between root and value, so that reading printed as@-px-4, and canonicalization returned it as the "canonical" form. That class doesn't compile (and@--foo-4became@---foo-4, which sets a different property).This skips the
-for a utility named@, the same wayprintVariantalready does for the@variant. Now both readings print back as the original class and nothing gets rewritten.Fixes #20607
Test plan
Added a regression test in
canonicalize-candidates.test.tsusing the plugin from the issue. It fails onmain(['@-px-4', '@---foo-4']) and passes with this change. Ranpnpm vitest runinpackages/tailwindcss, all tests pass.