tailwindcss/packages/@tailwindcss-upgrade/src
Robin Malfait 3da9d61371
Correctly migrate leading-* classes (#16004)
This PR fixes the upgrade tool by properly migrating the
`leading-[<number>]` classes.

The issue is that `leading-[<number>]` maps to the number directly, but
if you use a bare value, then it's a multiplier for based on the
`--spacing` value.

E.g.:

*leading-[2]*:
```css
.leading-\[2\] {
  --tw-leading: 2;
  line-height: 2;
}
@property --tw-leading {
  syntax: "*";
  inherits: false;
}
```

*leading-2*:
```css
.leading-2 {
  --tw-leading: calc(var(--spacing) * 2);
  line-height: calc(var(--spacing) * 2);
}
@property --tw-leading {
  syntax: "*";
  inherits: false;
}
```

This PR will now prevent migrating arbitrary values to bare values for
`leading-*` utilities.

That said, this does introduce a small improvement where `leading-[1]`
is migrated to `leading-none`.

Fixes: https://github.com/tailwindlabs/tailwindcss/issues/15924
2025-01-29 15:22:13 +01:00
..
codemods Implement @variant (#15663) 2025-01-21 10:20:35 -05:00
commands/help Add initial codemod tooling (#14434) 2024-09-18 16:45:43 +02:00
template Correctly migrate leading-* classes (#16004) 2025-01-29 15:22:13 +01:00
utils Improve performance of @tailwindcss/postcss and @tailwindcss/vite (#15226) 2024-11-29 10:59:29 -05:00
index.test.ts Revert new default form styles (#15100) 2024-11-22 08:55:05 -05:00
index.ts Upgrade: Error when project is already using Tailwind CSS v4 (#15015) 2024-11-19 15:53:02 +01:00
migrate-js-config.ts Implement @variant (#15663) 2025-01-21 10:20:35 -05:00
migrate-postcss.ts Improve PostCSS migration (#15046) 2024-11-19 22:56:29 +01:00
migrate-prettier.ts Improve robustness when upgrading (#15038) 2024-11-19 14:29:51 +01:00
migrate.ts Fix handling of absolute config files in upgrade tool (#15927) 2025-01-28 12:42:30 +01:00
stylesheet.ts Resolve imports from CSS file (#15010) 2024-11-15 22:06:52 +01:00