Skip to content

Canonicalization: print utilities named @ without a - after the @ - #20608

Open
lazerg wants to merge 4 commits into
tailwindlabs:mainfrom
lazerg:fix/issue-20607-canonicalize-at-root
Open

lazerg wants to merge 4 commits into
tailwindlabs:mainfrom
lazerg:fix/issue-20607-canonicalize-at-root

Conversation

@lazerg

@lazerg lazerg commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Summary

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.

Fixes #20607

Test plan

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.

@lazerg
lazerg requested a review from a team as a code owner October 22, 2026 14:22
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4b71c55a-4633-4e99-acf9-6385d4ae1440
📥 Commits

Reviewing files that changed from the base of the PR and between 8cc0551 and 2c2069f.

📒 Files selected for processing: 3
  • CHANGELOG.md
  • packages/tailwindcss/src/candidate.ts
  • packages/tailwindcss/src/canonicalize-candidates.test.ts

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: Passed 4
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: canonicalization no longer inserts a separator after a utility root named @.
Description check Passed The description directly explains the bug, the implementation change, the regression test, the expected results, and the reported test execution.
Linked Issues check Passed 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 Passed 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge.

Reviews (1) · Last reviewed commit: "update changelog" · Reviewed by Greptile

@lazerg

lazerg commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Hey @RobinMalfait, please take a look when you have time~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

canonicalizeCandidates rewrites every @… utility once a plugin registers a utility named @

1 participant