UNPKG

2.53 kBMarkdownView Raw
1# declaration-property-value-disallowed-list
2
3Specify a list of disallowed property and value pairs within declarations.
4
5<!-- prettier-ignore -->
6```css
7a { 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
16If 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
18The 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
20Be 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
22Given:
23
24```json
25{
26 "transform": ["/scale3d/", "/rotate3d/", "/translate3d/"],
27 "position": ["fixed"],
28 "color": ["/^green/"],
29 "/^animation/": ["/ease/"]
30}
31```
32
33The following patterns are considered problems:
34
35<!-- prettier-ignore -->
36```css
37a { position: fixed; }
38```
39
40<!-- prettier-ignore -->
41```css
42a { transform: scale3d(1, 2, 3); }
43```
44
45<!-- prettier-ignore -->
46```css
47a { -webkit-transform: scale3d(1, 2, 3); }
48```
49
50<!-- prettier-ignore -->
51```css
52a { color: green; }
53```
54
55<!-- prettier-ignore -->
56```css
57a { animation: foo 2s ease-in-out; }
58```
59
60<!-- prettier-ignore -->
61```css
62a { animation-timing-function: ease-in-out; }
63```
64
65<!-- prettier-ignore -->
66```css
67a { -webkit-animation-timing-function: ease-in-out; }
68```
69
70The following patterns are _not_ considered problems:
71
72<!-- prettier-ignore -->
73```css
74a { position: relative; }
75```
76
77<!-- prettier-ignore -->
78```css
79a { transform: scale(2); }
80```
81
82<!-- prettier-ignore -->
83```css
84a { -webkit-transform: scale(2); }
85```
86
87<!-- prettier-ignore -->
88```css
89a { color: lightgreen; }
90```
91
92<!-- prettier-ignore -->
93```css
94a { animation: foo 2s linear; }
95```
96
97<!-- prettier-ignore -->
98```css
99a { animation-timing-function: linear; }
100```
101
102<!-- prettier-ignore -->
103```css
104a { -webkit-animation-timing-function: linear; }
105```