1 | # declaration-property-unit-allowed-list
|
2 |
|
3 | Specify a list of allowed property and unit pairs within declarations.
|
4 |
|
5 |
|
6 | ```css
|
7 | a { width: 100px; }
|
8 | /** ↑ ↑
|
9 | * These properties and these units */
|
10 | ```
|
11 |
|
12 | ## Options
|
13 |
|
14 | `object`: `{ "unprefixed-property-name": ["array", "of", "units"] }`
|
15 |
|
16 | If a property name is surrounded with `"/"` (e.g. `"/^animation/"`), it is interpreted as a regular expression. This allows, for example, easy targeting of shorthands: `/^animation/` will match `animation`, `animation-duration`, `animation-timing-function`, etc.
|
17 |
|
18 | Given:
|
19 |
|
20 | ```
|
21 | {
|
22 | "font-size": ["em", "px"],
|
23 | "/^animation/": ["s"],
|
24 | "line-height": []
|
25 | }
|
26 | ```
|
27 |
|
28 | The following patterns are considered violations:
|
29 |
|
30 |
|
31 | ```css
|
32 | a { font-size: 1.2rem; }
|
33 | ```
|
34 |
|
35 |
|
36 | ```css
|
37 | a { animation: animation-name 500ms ease; }
|
38 | ```
|
39 |
|
40 |
|
41 | ```css
|
42 | a { -webkit-animation: animation-name 500ms ease; }
|
43 | ```
|
44 |
|
45 |
|
46 | ```css
|
47 | a { animation-duration: 500ms; }
|
48 | ```
|
49 |
|
50 |
|
51 | ```css
|
52 | a { line-height: 13px; }
|
53 | ```
|
54 |
|
55 | The following patterns are _not_ considered violations:
|
56 |
|
57 |
|
58 | ```css
|
59 | a { font-size: 1em; }
|
60 | ```
|
61 |
|
62 |
|
63 | ```css
|
64 | a { height: 100px; }
|
65 | ```
|
66 |
|
67 |
|
68 | ```css
|
69 | a { animation: animation-name 5s ease; }
|
70 | ```
|
71 |
|
72 |
|
73 | ```css
|
74 | a { -webkit-animation: animation-name 5s ease; }
|
75 | ```
|
76 |
|
77 |
|
78 | ```css
|
79 | a { animation-duration: 5s; }
|
80 | ```
|
81 |
|
82 |
|
83 | ```css
|
84 | a { line-height: 1; }
|
85 | ```
|