Skip to content

Commit cbff570

Browse files
committed
do not migrate group-[]:flex to in-[.group]:flex
Because this requires prefixing the `.group` if the prefix is configured.
1 parent 9def3a6 commit cbff570

File tree

2 files changed

+0
-35
lines changed

2 files changed

+0
-35
lines changed

packages/@tailwindcss-upgrade/src/template/codemods/modernize-arbitrary-values.test.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,6 @@ test.each([
1919
['[p_&]:flex', 'in-[p]:flex'],
2020
['[.foo_&]:flex', 'in-[.foo]:flex'],
2121
['[[data-visible]_&]:flex', 'in-data-visible:flex'],
22-
// Some extreme examples of what happens in the wild:
23-
['group-[]:flex', 'in-[.group]:flex'],
24-
['group-[]/name:flex', 'in-[.group\\/name]:flex'],
25-
26-
// These shouldn't happen in the real world (because compound variants are
27-
// new). But this could happen once we allow codemods to run in v4+ projects.
28-
['has-group-[]:flex', 'has-in-[.group]:flex'],
29-
['has-group-[]/name:flex', 'has-in-[.group\\/name]:flex'],
30-
['not-group-[]:flex', 'not-in-[.group]:flex'],
31-
['not-group-[]/name:flex', 'not-in-[.group\\/name]:flex'],
3222

3323
// nth-child
3424
['[&:nth-child(2)]:flex', 'nth-2:flex'],

packages/@tailwindcss-upgrade/src/template/codemods/modernize-arbitrary-values.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,6 @@ export function modernizeArbitraryValues(
2828
}
2929
}
3030

31-
// Promote `group-[]:flex` to `in-[.group]:flex`
32-
// ^^ Yes, this is empty
33-
// Promote `group-[]/name:flex` to `in-[.group\/name]:flex`
34-
if (
35-
variant.kind === 'compound' &&
36-
variant.root === 'group' &&
37-
variant.variant.kind === 'arbitrary' &&
38-
variant.variant.selector === '&:is()'
39-
) {
40-
// `group-[]`
41-
if (variant.modifier === null) {
42-
changed = true
43-
Object.assign(variant, designSystem.parseVariant('in-[.group]'))
44-
}
45-
46-
// `group-[]/name`
47-
else if (variant.modifier.kind === 'named') {
48-
changed = true
49-
Object.assign(
50-
variant,
51-
designSystem.parseVariant(`in-[.group\\/${variant.modifier.value}]`),
52-
)
53-
}
54-
}
55-
5631
// Expecting an arbitrary variant
5732
if (variant.kind !== 'arbitrary') continue
5833

0 commit comments

Comments
 (0)