Skip to content
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

Ensure the percentage data type is validated correctly #8015

Merged
merged 2 commits into from Apr 1, 2022

Conversation

RobinMalfait
Copy link
Contributor

When checking for our data types, we have to make sure that each part is correct, this wasn't happening for the percentage data type, which meant that top_right_50% was a valid percentage value because it ended in % which is not correct.

Because of this, the generated code was non-existent because we got a
warning:

The class `bg-[top_right_50%]` is ambiguous and matches multiple utilities.
  Use `bg-[length:top_right_50%]` for `background-size: top right 50%`
  Use `bg-[position:top_right_50%]` for `background-position: top right 50%`
If this is content and not a class, replace it with `bg-[top_right_50%]` to silence this warning.

But this is not correct because this can never be a valid background size due to the top right section.

This fixes it by validating each part individually, and now we get generated css.

Fixes: #7997

When checking for our data types, we have to make sure that each part is
correct, this wasn't happening for the `percentage` data type, which
meant that `top_right_50%` was a valid percentage value because it ended
in `%` which is not correct.

Because of this, the generated code was non-existent because we got a
warning:

  The class `bg-[top_right_50%]` is ambiguous and matches multiple utilities.
     Use `bg-[length:top_right_50%]` for `background-size: top right 50%`
     Use `bg-[position:top_right_50%]` for `background-position: top right 50%`
   If this is content and not a class, replace it with `bg-[top_right_50%]` to silence this warning.

But this is not correct because this can never be a valid background
size due to the `top right` section.

This fixes it by validating each part individually, and now we get
generated css.
@RobinMalfait RobinMalfait merged commit 2d3a748 into master Apr 1, 2022
@RobinMalfait RobinMalfait deleted the ensure-percentage-data-type-is-correct branch April 1, 2022 10:37
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.

Can't use % for background-position arbitrary value
1 participant