1 | # declaration-property-value-disallowed-list
|
2 |
|
3 | Specify a list of disallowed property and value pairs within declarations.
|
4 |
|
5 |
|
6 | ```css
|
7 | a { text-transform: uppercase; }
|
8 | /** ↑ ↑
|
9 | * These properties and these values */
|
10 | ```
|
11 |
|
12 | ## Options
|
13 |
|
14 | `object`: `{ "unprefixed-property-name": ["array", "of", "values"], "unprefixed-property-name": ["/regex/", "non-regex", /regex/] }`
|
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 | The same goes for values. Keep in mind that a regular expression value is matched against the entire value of the declaration, not specific parts of it. For example, a value like `"10px solid rgba( 255 , 0 , 0 , 0.5 )"` will _not_ match `"/^solid/"` (notice beginning of the line boundary) but _will_ match `"/\\s+solid\\s+/"` or `"/\\bsolid\\b/"`.
|
19 |
|
20 | Be careful with regex matching not to accidentally consider quoted string values and `url()` arguments. For example, `"/red/"` will match value such as `"1px dotted red"` as well as `"\"foo\""` and `"white url(/mysite.com/red.png)"`.
|
21 |
|
22 | Given:
|
23 |
|
24 | ```json
|
25 | {
|
26 | "transform": ["/scale3d/", "/rotate3d/", "/translate3d/"],
|
27 | "position": ["fixed"],
|
28 | "color": ["/^green/"],
|
29 | "/^animation/": ["/ease/"]
|
30 | }
|
31 | ```
|
32 |
|
33 | The following patterns are considered problems:
|
34 |
|
35 |
|
36 | ```css
|
37 | a { position: fixed; }
|
38 | ```
|
39 |
|
40 |
|
41 | ```css
|
42 | a { transform: scale3d(1, 2, 3); }
|
43 | ```
|
44 |
|
45 |
|
46 | ```css
|
47 | a { -webkit-transform: scale3d(1, 2, 3); }
|
48 | ```
|
49 |
|
50 |
|
51 | ```css
|
52 | a { color: green; }
|
53 | ```
|
54 |
|
55 |
|
56 | ```css
|
57 | a { animation: foo 2s ease-in-out; }
|
58 | ```
|
59 |
|
60 |
|
61 | ```css
|
62 | a { animation-timing-function: ease-in-out; }
|
63 | ```
|
64 |
|
65 |
|
66 | ```css
|
67 | a { -webkit-animation-timing-function: ease-in-out; }
|
68 | ```
|
69 |
|
70 | The following patterns are _not_ considered problems:
|
71 |
|
72 |
|
73 | ```css
|
74 | a { position: relative; }
|
75 | ```
|
76 |
|
77 |
|
78 | ```css
|
79 | a { transform: scale(2); }
|
80 | ```
|
81 |
|
82 |
|
83 | ```css
|
84 | a { -webkit-transform: scale(2); }
|
85 | ```
|
86 |
|
87 |
|
88 | ```css
|
89 | a { color: lightgreen; }
|
90 | ```
|
91 |
|
92 |
|
93 | ```css
|
94 | a { animation: foo 2s linear; }
|
95 | ```
|
96 |
|
97 |
|
98 | ```css
|
99 | a { animation-timing-function: linear; }
|
100 | ```
|
101 |
|
102 |
|
103 | ```css
|
104 | a { -webkit-animation-timing-function: linear; }
|
105 | ```
|