-
-
Notifications
You must be signed in to change notification settings - Fork 929
/
README.md
110 lines (77 loc) · 1.76 KB
/
README.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# alpha-value-notation
Specify percentage or number notation for alpha-values.
<!-- prettier-ignore -->
```css
a { color: rgb(0 0 0 / 0.5) }
/** ↑
* This notation */
```
The [`fix` option](../../../docs/user-guide/usage/options.md#fix) can automatically fix all of the problems reported by this rule.
## Options
`string`: `"number"|"percentage"`
### `"number"`
Alpha-values _must always_ use the number notation.
The following patterns are considered problems:
<!-- prettier-ignore -->
```css
a { opacity: 50% }
```
<!-- prettier-ignore -->
```css
a { color: rgb(0 0 0 / 50%) }
```
The following patterns are _not_ considered problems:
<!-- prettier-ignore -->
```css
a { opacity: 0.5 }
```
<!-- prettier-ignore -->
```css
a { color: rgb(0 0 0 / 0.5) }
```
### `"percentage"`
Alpha-values _must always_ use percentage notation.
The following patterns are considered problems:
<!-- prettier-ignore -->
```css
a { opacity: 0.5 }
```
<!-- prettier-ignore -->
```css
a { color: rgb(0 0 0 / 0.5) }
```
The following patterns are _not_ considered problems:
<!-- prettier-ignore -->
```css
a { opacity: 50% }
```
<!-- prettier-ignore -->
```css
a { color: rgb(0 0 0 / 50%) }
```
## Optional secondary options
### `exceptProperties: ["/regex/", /regex/, "string"]`
Reverse the primary option for matching properties.
For example with `"percentage"`.
Given:
```json
["opacity"]
```
The following patterns are considered problems:
<!-- prettier-ignore -->
```css
a { opacity: 50% }
```
<!-- prettier-ignore -->
```css
a { color: rgb(0 0 0 / 0.5) }
```
The following patterns are _not_ considered problems:
<!-- prettier-ignore -->
```css
a { opacity: 0.5 }
```
<!-- prettier-ignore -->
```css
a { color: rgb(0 0 0 / 50%) }
```