UNPKG

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