UNPKG

1.35 kBMarkdownView Raw
1# property-whitelist
2
3Specify a whitelist of allowed properties.
4
5<!-- prettier-ignore -->
6```css
7a { display: block; }
8/** ↑
9 * This property */
10```
11
12This rule ignores variables (`$sass`, `@less`, `--custom-property`).
13
14## Options
15
16`array|string`: `["array", "of", "unprefixed", /properties/ or "regex"]|"property"|"/regex/"`|/regex/
17
18If a string is surrounded with `"/"` (e.g. `"/^background/"`), it is interpreted as a regular expression. This allows, for example, easy targeting of shorthands: `/^background/` will match `background`, `background-size`, `background-color`, etc.
19
20Given:
21
22```
23["display", "animation", "/^background/"]
24```
25
26The following patterns are considered violations:
27
28<!-- prettier-ignore -->
29```css
30a { color: pink; }
31```
32
33<!-- prettier-ignore -->
34```css
35a {
36 animation: my-animation 2s;
37 color: pink;
38}
39```
40
41<!-- prettier-ignore -->
42```css
43a { borkgrund: orange; }
44```
45
46The following patterns are _not_ considered violations:
47
48<!-- prettier-ignore -->
49```css
50a { display: block; }
51```
52
53<!-- prettier-ignore -->
54```css
55a { -webkit-animation: my-animation 2s; }
56```
57
58<!-- prettier-ignore -->
59```css
60a {
61 animation: my-animation 2s;
62 -webkit-animation: my-animation 2s;
63 display: block;
64}
65```
66
67<!-- prettier-ignore -->
68```css
69a { background: pink; }
70```
71
72<!-- prettier-ignore -->
73```css
74a { background-color: pink; }
75```