From 9cb38993d2e68cd98b458ebd8c863e87bf7ce5ae Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Fri, 23 May 2025 17:21:21 +0200 Subject: [PATCH] Upgrade deprecated `order-none` to `order-0` (#18126) This PR adds an initial version for deprecated utilities. Right now it's hardcoded to just the `order-none` utility. This means that `order-0` and `order-[0]` will not be migrated to `order-none` anymore. We did that automatically because we prefer named utilities over bare values and arbitrary values. With this PR, `order-none` is ignored. Similarly, `order-none` will be migrated to `order-0` instead (defined in a separate migration for deprecated values). Made it a new migration instead of using the legacy migration because there all utilities still exist, but are defined differently (e.g.: `shadow`, `shadow-sm`, `shadow-xs`). This PR is also an initial version, it doesn't add any form of `deprecated` flag or feature on a per-utility implementation basis. This therefor has the side effect that if you have a custom `order-none` defined, that it will also be ignored during migrations. ## Test plan 1. Added tests to ensure the `order-0` is not migrated to `order-none` 2. Added tests to ensure `order-none` is migrated to `order-0` (if it's safe to do so, the signature is still computed to ensure the output is the same). 3. Ran this on the Tailwind Plus codebase and ensured that `order-0` is not migrated to `order-none` and that `order-none` is migrated to `order-0`. --------- Co-authored-by: Jordan Pittman --- CHANGELOG.md | 1 + .../src/codemods/template/candidates.ts | 8 +++ .../template/migrate-deprecated-utilities.ts | 52 +++++++++++++++++++ .../src/codemods/template/migrate.test.ts | 42 +++++++++++++++ .../src/codemods/template/migrate.ts | 2 + .../__snapshots__/intellisense.test.ts.snap | 1 - .../src/compat/legacy-utilities.ts | 2 + packages/tailwindcss/src/utilities.ts | 1 - 8 files changed, 107 insertions(+), 2 deletions(-) create mode 100644 packages/@tailwindcss-upgrade/src/codemods/template/migrate-deprecated-utilities.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b5c30e89..c002d985e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Upgrade: Do not migrate declarations that look like candidates in `