Skip to content

Migrate negative arbitrary values to negative bare values #18212

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

Merged
merged 3 commits into from
Jun 3, 2025

Conversation

RobinMalfait
Copy link
Member

This PR adds some improvements to the upgrade tool where it can now also migrate negative arbitrary values to negative bare values.

We already had support for the positive version of this:

- mb-[32rem]
+ mb-128

But now it can also handle negative values:

- mb-[-32rem]
+ -mb-128

The only tricky part here is that we had to hoist the - sign. Before this PR, we were actually generating mb--128 and that is invalid so it was thrown out.

Test plan

  1. Added a test to ensure that the negative values are correctly transformed.

@RobinMalfait RobinMalfait requested a review from a team as a code owner June 3, 2025 08:48
let rootPrefix = ''
if (spacingMultiplier !== null && spacingMultiplier < 0) {
rootPrefix = '-'
spacingMultiplier = Math.abs(spacingMultiplier)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also an option 🤔

Suggested change
spacingMultiplier = Math.abs(spacingMultiplier)
spacingMultiplier *= -1

@RobinMalfait RobinMalfait enabled auto-merge (squash) June 3, 2025 08:53
@RobinMalfait RobinMalfait merged commit b3fde17 into main Jun 3, 2025
7 checks passed
@RobinMalfait RobinMalfait deleted the feat/migrate-negative-arbitrary-values branch June 3, 2025 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants