1 | # media-feature-name-value-whitelist
|
2 |
|
3 | **_Deprecated: Instead use the [`media-feature-name-value-allowed-list`](../media-feature-name-value-allowed-list/README.md) rule._**
|
4 |
|
5 | Specify a list of allowed media feature name and value pairs.
|
6 |
|
7 |
|
8 | ```css
|
9 | @media screen and (min-width: 768px) {}
|
10 | /** ↑ ↑
|
11 | * These features and values */
|
12 | ```
|
13 |
|
14 | ## Options
|
15 |
|
16 | ```js
|
17 | {
|
18 | "unprefixed-media-feature-name": ["array", "of", "values"],
|
19 | "/unprefixed-media-feature-name/": ["/regex/", "non-regex", /real-regex/]
|
20 | }
|
21 | ```
|
22 |
|
23 | If a media feature name is found in the object, only its allowed-listed values are
|
24 | allowed. If the media feature name is not included in the object, anything goes.
|
25 |
|
26 | If a name or value is surrounded with `/` (e.g. `"/width$/"`), it is interpreted
|
27 | as a regular expression. For example, `/width$/` will match `max-width` and
|
28 | `min-width`.
|
29 |
|
30 | Given:
|
31 |
|
32 | ```
|
33 | {
|
34 | "min-width": ["768px", "1024px"],
|
35 | "/resolution/": ["/dpcm$/"]
|
36 | }
|
37 | ```
|
38 |
|
39 | The following patterns are considered violations:
|
40 |
|
41 |
|
42 | ```css
|
43 | @media screen and (min-width: 1000px) {}
|
44 | ```
|
45 |
|
46 |
|
47 | ```css
|
48 | @media screen and (min-resolution: 2dpi) {}
|
49 | ```
|
50 |
|
51 |
|
52 | ```css
|
53 | @media screen and (min-width > 1000px) {}
|
54 | ```
|
55 |
|
56 | The following patterns are _not_ considered violations:
|
57 |
|
58 |
|
59 | ```css
|
60 | @media screen and (min-width: 768px) {}
|
61 | ```
|
62 |
|
63 |
|
64 | ```css
|
65 | @media screen and (min-width: 1024px) {}
|
66 | ```
|
67 |
|
68 |
|
69 | ```css
|
70 | @media screen and (orientation: portrait) {}
|
71 | ```
|
72 |
|
73 |
|
74 | ```css
|
75 | @media screen and (min-resolution: 2dpcm) {}
|
76 | ```
|
77 |
|
78 |
|
79 | ```css
|
80 | @media screen and (resolution: 10dpcm) {}
|
81 | ```
|
82 |
|
83 |
|
84 | ```css
|
85 | @media screen and (768px < min-width) {}
|
86 | ```
|