tailwindcss/packages
Robin Malfait 12833aa4b3
Fix canonicalization bug where we end up with a high precision number (#20221)
This PR fixes a bug where we suggest a canonicalization with a high
precision number.

E.g.:

`w-[calc(100%/3.5)]` → `w-[28.571428571428573%]`

While this is technically correct, it's also not as user friendly. This
PR solves this issue by checking whether the result has a precision of
`.xx` at most. If that's not the case, then we keep the original
expression.

Fixes:
https://github.com/tailwindlabs/tailwindcss-intellisense/issues/1591

## Test plan

1. Added an a regression test for this situation
2. Existing tests pass
2026-06-12 00:23:11 +02:00
..
@tailwindcss-browser Bump dependencies (#20095) 2026-05-21 17:58:55 +02:00
@tailwindcss-cli Ignore the standalone CLI (#20139) 2026-06-02 12:49:53 +02:00
@tailwindcss-node duration must be at least 500ms 2026-05-26 23:34:51 +02:00
@tailwindcss-postcss Bump dependencies (#20095) 2026-05-21 17:58:55 +02:00
@tailwindcss-standalone Bump dependencies (#20095) 2026-05-21 17:58:55 +02:00
@tailwindcss-upgrade Do not crash when migrating empty classes (#20205) 2026-06-07 21:50:35 +02:00
@tailwindcss-vite Fix 'Sourcemap is likely to be incorrect' warnings when using @tailwindcss/vite (#20103) 2026-05-22 17:57:25 +02:00
@tailwindcss-webpack Add Rspack optional peer dependency for @tailwindcss/webpack (#20027) 2026-05-23 11:14:48 +02:00
internal-example-plugin Prefix internal modules with internal-* (#14074) 2024-07-29 10:58:07 -04:00
tailwindcss Fix canonicalization bug where we end up with a high precision number (#20221) 2026-06-12 00:23:11 +02:00
tsconfig.base.json Improve debug logs (#15303) 2024-12-11 15:27:20 +01:00