Commit 2fd7c8d
authored
Show warning when using unsupported bare value data type (#17464)
This PR will show a warning if you are using a bare value data type that
is not supported.
Let's say you want to create a new utility that allows `color` to be a
bare value data type like this:
```css
@Utility paint-* {
paint: --value([color], color);
}
```
This means that this would enable new syntax that we don't support yet.
E.g.: `paint-#0088cc`.
The only supported data types for bare values are:
- `number` — `2.5`
- `integer` — `2`
- `ratio` — `1/2`
- `percentage` — `50%`
All other data types are not supported in this position. This PR will
now show a warning:
~~~
Unsupported bare value data type: "color".
Only valid data types are: "number", "integer", "ratio", "percentage".
```css
--value([color],color)
^^^^^
```
~~~
Once we have better sourcemap / location tracking support, this warning
will point to the exact spot, but for now, only a re-print of the AST
can be used.
If you _do_ want to use other data types, then you will have to use
arbitrary value syntax with `[…]` instead.
```css
@Utility paint-* {
paint: --value([color]);
}
```
This will allow for `paint-[#0088cc]` for example.
Note: this is not a behavioral change, we already didn't support other
data types, but we silently ignored them. This means that we have to do
more parsing at runtime when evaluating the utility.
With this change, a warning is shown when registering the `@utility`,
not when using it.1 parent 57e55a6 commit 2fd7c8d
File tree
3 files changed
+73
-9
lines changed- packages/tailwindcss/src
3 files changed
+73
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
26530 | 26530 | | |
26531 | 26531 | | |
26532 | 26532 | | |
| 26533 | + | |
| 26534 | + | |
| 26535 | + | |
| 26536 | + | |
| 26537 | + | |
| 26538 | + | |
| 26539 | + | |
| 26540 | + | |
| 26541 | + | |
| 26542 | + | |
| 26543 | + | |
| 26544 | + | |
| 26545 | + | |
| 26546 | + | |
| 26547 | + | |
| 26548 | + | |
| 26549 | + | |
| 26550 | + | |
| 26551 | + | |
| 26552 | + | |
| 26553 | + | |
| 26554 | + | |
| 26555 | + | |
| 26556 | + | |
| 26557 | + | |
| 26558 | + | |
| 26559 | + | |
| 26560 | + | |
26533 | 26561 | | |
26534 | 26562 | | |
26535 | 26563 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5692 | 5692 | | |
5693 | 5693 | | |
5694 | 5694 | | |
| 5695 | + | |
| 5696 | + | |
| 5697 | + | |
| 5698 | + | |
| 5699 | + | |
| 5700 | + | |
| 5701 | + | |
| 5702 | + | |
| 5703 | + | |
| 5704 | + | |
5695 | 5705 | | |
5696 | 5706 | | |
5697 | 5707 | | |
| |||
5824 | 5834 | | |
5825 | 5835 | | |
5826 | 5836 | | |
5827 | | - | |
5828 | 5837 | | |
5829 | 5838 | | |
5830 | 5839 | | |
| |||
5841 | 5850 | | |
5842 | 5851 | | |
5843 | 5852 | | |
| 5853 | + | |
| 5854 | + | |
| 5855 | + | |
| 5856 | + | |
| 5857 | + | |
| 5858 | + | |
| 5859 | + | |
| 5860 | + | |
| 5861 | + | |
| 5862 | + | |
| 5863 | + | |
| 5864 | + | |
| 5865 | + | |
| 5866 | + | |
| 5867 | + | |
| 5868 | + | |
| 5869 | + | |
| 5870 | + | |
| 5871 | + | |
| 5872 | + | |
| 5873 | + | |
| 5874 | + | |
| 5875 | + | |
| 5876 | + | |
| 5877 | + | |
| 5878 | + | |
| 5879 | + | |
| 5880 | + | |
| 5881 | + | |
| 5882 | + | |
5844 | 5883 | | |
5845 | 5884 | | |
5846 | 5885 | | |
| |||
6084 | 6123 | | |
6085 | 6124 | | |
6086 | 6125 | | |
6087 | | - | |
6088 | | - | |
6089 | | - | |
6090 | | - | |
6091 | | - | |
6092 | | - | |
| 6126 | + | |
6093 | 6127 | | |
6094 | 6128 | | |
6095 | 6129 | | |
| |||
0 commit comments