-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve in-*
variant migrations
#15054
Merged
Merged
Conversation
This file contains 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
This test fails and was converted to `in-[figure>]` which is incorrect. The reason is because we only checked for `&` and the very end, but it should be preceded by a combinator space.
It's a little bit silly, but during debugging I noticed that the `variant` looked all funky. This is because we convert one variant to another via `Object.assign`. It does work properly because we compare the `kind` field (which gets converted), and then we know that all the properties of the new `kind` are available. With this change we first clear out all the existing keys, resulting in an expected shape when inspecting the `variant`.
If you use a prefix, migrate `group-[]:tw-flex` to `tw:in-[.tw\:group]:flex`
Instead of bailing early, let's nest it to keep it consistent with other migrations in the current file. Every "migration" should be guarded by some if statements.
If multiple nodes are valid, it could result in different specificity because the `in-*` variant wraps everything in a `:where(…)`.
thecrypticace
approved these changes
Nov 20, 2024
RobinMalfait
force-pushed
the
fix/improve-in-variant-migrations
branch
from
November 20, 2024 14:47
0f14708
to
2c3293b
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
While testing the codemods on some projects, I noticed some issues with the migration to the new
in-*
variant.One such example is that we checked for
&
at the end, instead of&
(the whitespace is significant).This meant that
[figure>&]:my-0
was converted toin-[figure>]:my-0
which is wrong. In this case, we want to keep it as[figure>&]:my-0
.Additionally this PR brings back the migration from
group-[]:flex
toin-[.group]:flex
. If you are using a prefix, thengroup-[]:tw-flex
is migrated totw:in-[.tw\:group]:flex
.Last but not least, this does some internal refactors to group migrations logically together.