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