1 | # unit-blacklist
|
2 |
|
3 | Specify a blacklist of disallowed units.
|
4 |
|
5 | ```css
|
6 | a { width: 100px; }
|
7 | /** ↑
|
8 | * These units */
|
9 | ```
|
10 |
|
11 | ## Options
|
12 |
|
13 | `array|string`: `["array", "of", "units"]|"unit"`
|
14 |
|
15 | Given:
|
16 |
|
17 | ```js
|
18 | ["px", "em", "deg"]
|
19 | ```
|
20 |
|
21 | The following patterns are considered violations:
|
22 |
|
23 | ```css
|
24 | a { width: 100px; }
|
25 | ```
|
26 |
|
27 | ```css
|
28 | a { font-size: 10em; }
|
29 | ```
|
30 |
|
31 | ```css
|
32 | a { transform: rotate(30deg); }
|
33 | ```
|
34 |
|
35 | The following patterns are *not* considered violations:
|
36 |
|
37 | ```css
|
38 | a { font-size: 1.2rem; }
|
39 | ```
|
40 |
|
41 | ```css
|
42 | a { line-height: 1.2; }
|
43 | ```
|
44 |
|
45 | ```css
|
46 | a { height: 100vmin; }
|
47 | ```
|
48 |
|
49 | ```css
|
50 | a { animation: animation-name 5s ease; }
|
51 | ```
|
52 |
|
53 | ## Optional secondary options
|
54 |
|
55 | ### `ignoreProperties: { unit: ["property", "/regex/", /regex/] }`
|
56 |
|
57 | Ignore units in the values of declarations with the specified properties.
|
58 |
|
59 | For example, with `["px", "vmin"]`.
|
60 |
|
61 | Given:
|
62 |
|
63 | ```js
|
64 | {
|
65 | "px": [ "font-size", "/^border/" ],
|
66 | "vmin": [ "width" ]
|
67 | }
|
68 | ```
|
69 |
|
70 | The following patterns are *not* considered violations:
|
71 |
|
72 | ```css
|
73 | a { font-size: 13px; }
|
74 | ```
|
75 |
|
76 | ```css
|
77 | a { border-bottom-width: 6px; }
|
78 | ```
|
79 |
|
80 | ```css
|
81 | a { width: 100vmin; }
|
82 | ```
|
83 |
|
84 | The following patterns are considered violations:
|
85 |
|
86 | ```css
|
87 | a { line-height: 12px; }
|
88 | ```
|
89 |
|
90 | ```css
|
91 | a { -moz-border-radius-topright: 40px; }
|
92 | ```
|
93 |
|
94 | ```css
|
95 | a { height: 100vmin; }
|
96 | ```
|
97 |
|
98 | ### `ignoreMediaFeatureNames: { unit: ["property", "/regex/", /regex/] }`
|
99 |
|
100 | Ignore units for specific feature names.
|
101 |
|
102 | For example, with `["px", "dpi"]`.
|
103 |
|
104 | Given:
|
105 |
|
106 | ```js
|
107 | {
|
108 | "px": [ "min-width", "/height$/" ],
|
109 | "dpi": [ "resolution" ]
|
110 | }
|
111 | ```
|
112 |
|
113 | The following patterns are *not* considered violations:
|
114 |
|
115 | ```css
|
116 | @media (min-width: 960px) {}
|
117 | ```
|
118 |
|
119 | ```css
|
120 | @media (max-height: 280px) {}
|
121 | ```
|
122 |
|
123 | ```css
|
124 | @media not (resolution: 300dpi) {}
|
125 | ```
|
126 |
|
127 | The following patterns are considered violations:
|
128 |
|
129 | ```css
|
130 | @media screen and (max-device-width: 500px) {}
|
131 | ```
|
132 |
|
133 | ```css
|
134 | @media all and (min-width: 500px) and (max-width: 200px) {}
|
135 | ```
|
136 |
|
137 | ```css
|
138 | @media print and (max-resolution: 100dpi) {}
|
139 | ```
|