1 | # value-keyword-case
|
2 |
|
3 | Specify lowercase or uppercase for keywords values.
|
4 |
|
5 |
|
6 | ```css
|
7 | a { display: block; }
|
8 | /** ↑
|
9 | * These values */
|
10 | ```
|
11 |
|
12 | This rule ignores [`<custom-idents>`](https://developer.mozilla.org/en/docs/Web/CSS/custom-ident) of known properties. Keyword values which are paired with non-properties (e.g. `$vars` and custom properties), and do not conform to the primary option, can be ignored using the `ignoreKeywords: []` secondary option.
|
13 |
|
14 | The [`fix` option](../../../docs/user-guide/usage/options.md#fix) can automatically fix all of the problems reported by this rule.
|
15 |
|
16 | ## Options
|
17 |
|
18 | `string`: `"lower"|"upper"`
|
19 |
|
20 | ### `"lower"`
|
21 |
|
22 | The following patterns are considered violations:
|
23 |
|
24 |
|
25 | ```css
|
26 | a {
|
27 | display: Block;
|
28 | }
|
29 | ```
|
30 |
|
31 |
|
32 | ```css
|
33 | a {
|
34 | display: bLoCk;
|
35 | }
|
36 | ```
|
37 |
|
38 |
|
39 | ```css
|
40 | a {
|
41 | display: BLOCK;
|
42 | }
|
43 | ```
|
44 |
|
45 |
|
46 | ```css
|
47 | a {
|
48 | transition: -WEBKIT-TRANSFORM 2s;
|
49 | }
|
50 | ```
|
51 |
|
52 | The following patterns are _not_ considered violations:
|
53 |
|
54 |
|
55 | ```css
|
56 | a {
|
57 | display: block;
|
58 | }
|
59 | ```
|
60 |
|
61 |
|
62 | ```css
|
63 | a {
|
64 | transition: -webkit-transform 2s;
|
65 | }
|
66 | ```
|
67 |
|
68 | ### `"upper"`
|
69 |
|
70 | The following patterns are considered violations:
|
71 |
|
72 |
|
73 | ```css
|
74 | a {
|
75 | display: Block;
|
76 | }
|
77 | ```
|
78 |
|
79 |
|
80 | ```css
|
81 | a {
|
82 | display: bLoCk;
|
83 | }
|
84 | ```
|
85 |
|
86 |
|
87 | ```css
|
88 | a {
|
89 | display: block;
|
90 | }
|
91 | ```
|
92 |
|
93 |
|
94 | ```css
|
95 | a {
|
96 | transition: -webkit-transform 2s;
|
97 | }
|
98 | ```
|
99 |
|
100 | The following patterns are _not_ considered violations:
|
101 |
|
102 |
|
103 | ```css
|
104 | a {
|
105 | display: BLOCK;
|
106 | }
|
107 | ```
|
108 |
|
109 |
|
110 | ```css
|
111 | a {
|
112 | transition: -WEBKIT-TRANSFORM 2s;
|
113 | }
|
114 | ```
|
115 |
|
116 | ## Optional secondary options
|
117 |
|
118 | ### `ignoreKeywords: ["/regex/", /regex/, "non-regex"]`
|
119 |
|
120 | Ignore case of keywords values.
|
121 |
|
122 | For example, with `"lower"`.
|
123 |
|
124 | Given:
|
125 |
|
126 | ```
|
127 | ["Block", "/^(f|F)lex$/"]
|
128 | ```
|
129 |
|
130 | The following patterns are considered violations:
|
131 |
|
132 |
|
133 | ```css
|
134 | a {
|
135 | display: bLoCk;
|
136 | }
|
137 | ```
|
138 |
|
139 |
|
140 | ```css
|
141 | a {
|
142 | display: BLOCK;
|
143 | }
|
144 | ```
|
145 |
|
146 |
|
147 | ```css
|
148 | a {
|
149 | display: fLeX;
|
150 | }
|
151 | ```
|
152 |
|
153 |
|
154 | ```css
|
155 | a {
|
156 | display: FLEX;
|
157 | }
|
158 | ```
|
159 |
|
160 | The following patterns are _not_ considered violations:
|
161 |
|
162 |
|
163 | ```css
|
164 | a {
|
165 | display: block;
|
166 | }
|
167 | ```
|
168 |
|
169 |
|
170 | ```css
|
171 | a {
|
172 | display: Block;
|
173 | }
|
174 | ```
|
175 |
|
176 |
|
177 | ```css
|
178 | a {
|
179 | display: flex;
|
180 | }
|
181 | ```
|
182 |
|
183 |
|
184 | ```css
|
185 | a {
|
186 | display: Flex;
|
187 | }
|
188 | ```
|
189 |
|
190 | ### `ignoreProperties: ["/regex/", /regex/, "non-regex"]`
|
191 |
|
192 | Ignore case of the values of the listed properties.
|
193 |
|
194 | For example, with `"lower"`.
|
195 |
|
196 | ```js
|
197 | ["/^(b|B)ackground$/", "display"];
|
198 | ```
|
199 |
|
200 | The following patterns are considered violations:
|
201 |
|
202 |
|
203 | ```css
|
204 | a {
|
205 | text-align: LEFT;
|
206 | }
|
207 | ```
|
208 |
|
209 |
|
210 | ```css
|
211 | a {
|
212 | text-align: Left;
|
213 | }
|
214 | ```
|
215 |
|
216 | The following patterns are _not_ considered violations:
|
217 |
|
218 |
|
219 | ```css
|
220 | a {
|
221 | display: bloCk;
|
222 | }
|
223 | ```
|
224 |
|
225 |
|
226 | ```css
|
227 | a {
|
228 | display: BloCk;
|
229 | }
|
230 | ```
|
231 |
|
232 |
|
233 | ```css
|
234 | a {
|
235 | display: BLOCK;
|
236 | }
|
237 | ```
|
238 |
|
239 |
|
240 | ```css
|
241 | a {
|
242 | display: block;
|
243 | }
|
244 | ```
|
245 |
|
246 |
|
247 | ```css
|
248 | a {
|
249 | background: Red;
|
250 | }
|
251 | ```
|
252 |
|
253 |
|
254 | ```css
|
255 | a {
|
256 | Background: deepPink;
|
257 | }
|
258 | ```
|
259 |
|
260 | ### `ignoreFunctions: ["/regex/", /regex/, "non-regex"]`
|
261 |
|
262 | Ignore case of the values inside the listed functions.
|
263 |
|
264 | For example, with `"upper"`.
|
265 |
|
266 | ```js
|
267 | ["/^(f|F)oo$/", "t"];
|
268 | ```
|
269 |
|
270 | The following patterns are considered violations:
|
271 |
|
272 |
|
273 | ```css
|
274 | a {
|
275 | display: b(inline);
|
276 | }
|
277 | ```
|
278 |
|
279 | ```css
|
280 | a {
|
281 | color: bar(--camelCase);
|
282 | }
|
283 | ```
|
284 |
|
285 | The following patterns are _not_ considered violations:
|
286 |
|
287 |
|
288 | ```css
|
289 | a {
|
290 | display: t(flex);
|
291 | }
|
292 | ```
|
293 |
|
294 |
|
295 | ```css
|
296 | a {
|
297 | display: t(fLeX);
|
298 | }
|
299 | ```
|
300 |
|
301 |
|
302 | ```css
|
303 | a {
|
304 | color: t(--camelCase);
|
305 | }
|
306 | ```
|
307 |
|
308 |
|
309 | ```css
|
310 | a {
|
311 | color: foo(--camelCase);
|
312 | }
|
313 | ```
|
314 |
|
315 |
|
316 | ```css
|
317 | a {
|
318 | color: Foo(--camelCase);
|
319 | }
|
320 | ```
|