Improve canonicalization for bare values exceeding default spacing scale suggestions#19809
Improve canonicalization for bare values exceeding default spacing scale suggestions#19809RobinMalfait merged 3 commits intomainfrom
Conversation
By default we use intellisense' provided values which typically go up to `96` by default. But since a lot of utilities accept bare values, we still want to be able to collapse `w-1234 h-1234` into `size-1234`. This code enables that. We do loop over all functional utility functions, but we are only interested in utilities that set one of the properties that the original candidate also sets. Otherwise all utilities that accept `*-1234` as a value would be in the list, which is not what we want and will never match so it's unnecessary work.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughThis pull request enhances canonicalization functionality for Tailwind CSS utilities. A new 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📝 Coding Plan
Comment Tip You can generate walkthrough in a markdown collapsible section to save space.Enable the |
This PR adds support for canonicalization of utilities that accept bare values and exceed the default spacing scale we use for intellisense.
Right now, all utilities are behind functions, so the only way to know whether something compiles is by compiling a candidate, e.g.
w-8and passing it to the utility functions. To help us, we use the intellisense APIs that we use for suggestions.Most utilities that accept bare values, have suggestions up until
*-96, sow-96 h-96would be canonicalized tosize-96. But the moment we exceed that, the result stays as-is.This PR ensures that the last scenario also gets canonicalized to
size-1234instead of staying ash-1234 w-1234.Test plan
[ci-all] just to see if this additional logic doesn't cause timeouts in CI for WIndows. In my testing this doesn't have a significant impact on performance at all.