.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / stylelint / lib / rules / declaration-property-value-whitelist / README.md
1 # declaration-property-value-whitelist
2
3 Specify a whitelist of allowed property and value pairs within declarations.
4
5 ```css
6 a { text-transform: uppercase; }
7 /** ↑               ↑
8  * These properties and these values */
9 ```
10
11 ## Options
12
13 `object`: `{
14   "unprefixed-property-name": ["array", "of", "values"],
15   "unprefixed-property-name": ["/regex/", "non-regex"]
16 }`
17
18 If a property name is found in the object, only its whitelisted property values are allowed. This rule complains about all non-matching values. (If the property name is not included in the object, anything goes.)
19
20 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.
21
22 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/"`.
23
24 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)"`.
25
26 Given:
27
28 ```js
29 {
30   "transform": ["/scale/"],
31   "whitespace": ["nowrap"],
32   "/color/": ["/^green/"]
33 }
34 ```
35
36 The following patterns are considered violations:
37
38 ```css
39 a { whitespace: pre; }
40 ```
41
42 ```css
43 a { transform: translate(1, 1); }
44 ```
45
46 ```css
47 a { -webkit-transform: translate(1, 1); }
48 ```
49
50 ```css
51 a { color: pink; }
52 ```
53
54 ```css
55 a { background-color: pink; }
56 ```
57
58 The following patterns are *not* considered violations:
59
60 ```css
61 a { color: pink; }
62 ```
63
64 ```css
65 a { whitespace: nowrap; }
66 ```
67
68 ```css
69 a { transform: scale(1, 1); }
70 ```
71
72 ```css
73 a { -webkit-transform: scale(1, 1); }
74 ```
75
76 ```css
77 a { color: green; }
78 ```
79
80 ```css
81 a { background-color: green; }
82 ```
83
84 ```css
85 a { background: pink; }
86 ```