1package stylelint
2
3import (
4 "list"
5 "net"
6)
7
8// JSON schema for the Stylelint configuration files
9#Schema: {
10 @jsonschema(schema="http://json-schema.org/draft-07/schema#")
11 @jsonschema(id="https://json.schemastore.org/stylelintrc.json")
12 extends?: #simpleStringOrArrayStringRule
13 plugins?: #simpleArrayStringRule
14
15 // Specify a custom syntax to use on your code.
16 customSyntax?: string
17
18 // Provide rule and behavior overrides for files that match particular glob patterns.
19 overrides?: [...{
20 files?: [...string]
21 customSyntax?: string
22 rules?: #allRules
23 ...
24 }]
25
26 // Processors are functions that hook into stylelint's pipeline, modifying code
27 // on its way into stylelint and modifying results on their way out
28 processors?: [...matchN(>=1, [
29 string,
30 {
31 [...]
32 [0]: string
33 [>=1]: {...}
34 }
35 ])]
36
37 // Ignore stylelint-disable (e.g. /* stylelint-disable block-no-empty */) comments.
38 ignoreDisables?: bool
39 ignoreFiles?: #simpleStringOrArrayStringRule
40
41 // The default severity level for all rules that do not have a severity
42 // specified in their secondary options
43 defaultSeverity?: "warning" | "error"
44 reportDescriptionlessDisables?: #booleanRule
45 reportInvalidScopeDisables?: #booleanRule
46 reportNeedlessDisables?: #booleanRule
47 rules?: #allRules
48
49 #allRules: #atRule &
50 {...} &
51 #block &
52 {...} &
53 #color &
54 {...} &
55 #comment &
56 {...} &
57 #customMedia &
58 {...} &
59 #customProperty &
60 {...} &
61 #declaration &
62 {...} &
63 #declarationBlock &
64 {...} &
65 #font &
66 {...} &
67 #function &
68 {...} &
69 #generalSheet &
70 {...} &
71 #keyframeDeclaration &
72 {...} &
73 #length &
74 {...} &
75 #lightness &
76 {...} &
77 #mediaFeature &
78 {...} &
79 #mediaQuery &
80 {...} &
81 #mediaQueryList &
82 {...} &
83 #number &
84 {...} &
85 #property &
86 {...} &
87 #rootRule &
88 {...} &
89 #rule &
90 {...} &
91 #selector &
92 {...} &
93 #selectorList &
94 {...} &
95 #shorthandProperty &
96 {...} &
97 #string &
98 {...} &
99 #stylelintDisableComment &
100 {...} &
101 #time &
102 {...} &
103 #unit &
104 {...} &
105 #value &
106 {...} &
107 #valueList &
108 {...}
109
110 #alwaysMultiLineRule: matchN(1, [
111 null,
112 "always" | "always-multi-line",
113 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [
114 ...matchN(>=1, ["always" | "always-multi-line", #coreRule])
115 ]
116 ])
117
118 #alwaysNeverRule: matchN(1, [
119 null,
120 "always" | "never",
121 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, ["always" | "never", #coreRule])]
122 ])
123
124 #arrayStringRule: matchN(1, [
125 null | string,
126 list.MinItems(1) & list.UniqueItems() & [...matchN(>=1, [#simpleArrayStringRule, #coreRule])]
127 ])
128
129 #atRule: null | bool | number | string | [...] | {
130 "at-rule-blacklist"?: #arrayStringRule
131
132 // Require or disallow an empty line before at-rules
133 "at-rule-empty-line-before"?: matchN(1, [
134 null,
135 "always" | "never",
136 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
137 "always" | "never",
138 #coreRule & {
139 except?: list.UniqueItems() & list.MinItems(1) & [
140 ..."all-nested" |
141 "after-same-name" |
142 "inside-block" |
143 "blockless-after-same-name-blockless" |
144 "blockless-after-blockless" |
145 "first-nested"
146 ]
147 ignore?: list.UniqueItems() & list.MinItems(1) & [
148 ..."after-comment" |
149 "first-nested" |
150 "inside-block" |
151 "blockless-after-same-name-blockless" |
152 "blockless-after-blockless"
153 ]
154 ignoreAtRules?: #simpleStringOrArrayStringRule
155 ...
156 }
157 ])]
158 ])
159 "at-rule-name-case"?: #lowerUpperRule
160 "at-rule-name-newline-after"?: #alwaysMultiLineRule
161
162 // Require a single space after at-rule names
163 "at-rule-name-space-after"?: matchN(1, [
164 null,
165 "always" | "always-single-line",
166 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [
167 ...matchN(>=1, ["always" | "always-single-line", #coreRule])
168 ]
169 ])
170
171 // Disallow unknown at-rules
172 "at-rule-no-unknown"?: matchN(1, [
173 null,
174 true,
175 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
176 true,
177 #coreRule & {
178 ignoreAtRules?: #simpleArrayStringRule
179 ...
180 }
181 ])]
182 ])
183 "at-rule-no-vendor-prefix"?: #booleanRule
184
185 // Require a newline after the semicolon of at-rules
186 "at-rule-semicolon-newline-after"?: matchN(1, [
187 null,
188 "always",
189 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, ["always", #coreRule])]
190 ])
191
192 // Require a single space or disallow whitespace before the semicolons of at-rules
193 "at-rule-semicolon-space-before"?: _
194 "at-rule-whitelist"?: #arrayStringRule
195 ...
196 }
197
198 #block: null | bool | number | string | [...] | {
199 // Require or disallow an empty line before the closing brace of blocks
200 "block-closing-brace-empty-line-before"?: matchN(1, [
201 null,
202 "always-multi-line" | "never",
203 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [
204 ...matchN(>=1, ["always-multi-line" | "never", #coreRule])
205 ]
206 ])
207 "block-closing-brace-newline-after"?: #newlineSpaceWithIgnoreRule
208 "block-closing-brace-newline-before"?: #newlineRule
209 "block-closing-brace-space-after"?: #newlineSpaceRule
210 "block-closing-brace-space-before"?: #newlineSpaceRule
211 "block-no-empty"?: #booleanRule
212 "block-no-single-line"?: #booleanRule
213 "block-opening-brace-newline-after"?: #newlineRule
214
215 // Require a newline or disallow whitespace before the opening brace of blocks
216 "block-opening-brace-newline-before"?: matchN(1, [
217 null,
218 "always" | "always-single-line" | "never-single-line" | "always-multi-line" | "never-multi-line",
219 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [
220 ...matchN(>=1, [
221 "always" | "always-single-line" | "never-single-line" | "always-multi-line" | "never-multi-line",
222 #coreRule,
223 ])
224 ]
225 ])
226 "block-opening-brace-space-after"?: #newlineSpaceRule
227 "block-opening-brace-space-before"?: #newlineSpaceWithIgnoreRule
228 ...
229 }
230
231 #booleanRule: matchN(1, [
232 null,
233 bool,
234 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [bool, #coreRule])]
235 ])
236
237 #color: null | bool | number | string | [...] | {
238 "color-hex-case"?: #lowerUpperRule
239
240 // Specify short or long notation for hex colors
241 "color-hex-length"?: matchN(1, [
242 null,
243 "short" | "long",
244 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, ["short" | "long", #coreRule])]
245 ])
246
247 // Require (where possible) or disallow named colors
248 "color-named"?: matchN(1, [
249 null,
250 "always-where-possible" | "never",
251 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
252 "always-where-possible" | "never",
253 #coreRule & {
254 ignore?: #simpleArrayStringRule
255 ...
256 }
257 ])]
258 ])
259 "color-no-hex"?: #booleanRule
260 "color-no-invalid-hex"?: #booleanRule
261 ...
262 }
263
264 #comment: null | bool | number | string | [...] | {
265 // Require or disallow an empty line before comments
266 "comment-empty-line-before"?: matchN(1, [
267 null,
268 "always" | "never",
269 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
270 "always" | "never",
271 #coreRule & {
272 // Reverse the primary option for comments that are nested and the first child of their parent node
273 except?: list.UniqueItems() & list.MinItems(1) & [..."first-nested"]
274
275 // Don't require an empty line between comments
276 ignore?: list.UniqueItems() & list.MinItems(1) & [
277 ..."between-comments" | "after-comment" | "stylelint-command" | "stylelint-commands"
278 ]
279 ...
280 }
281 ])]
282 ])
283 "comment-no-empty"?: #booleanRule
284 "comment-whitespace-inside"?: #alwaysNeverRule
285 "comment-word-blacklist"?: #arrayStringRule
286 ...
287 }
288
289 #coreRule: {
290 disableFix?: bool
291
292 // Custom message that will be used in errors and warnings
293 message?: string
294 reportDisables?: bool
295
296 // Message status
297 severity?: "warning" | "error"
298 url?: net.AbsURL
299 ...
300 }
301
302 #customMedia: null | bool | number | string | [...] | {
303 "custom-media-pattern"?: #stringRule
304
305 // Disallow unknown custom media queries
306 "no-unknown-custom-media"?: matchN(1, [
307 matchN(1, [true, null]),
308 list.MaxItems(2) & {
309 [matchN(1, [true, null]), ...]
310 [1]: #coreRule
311 }
312 ])
313 ...
314 }
315
316 #customProperty: null | bool | number | string | [...] | {
317 // Require or disallow an empty line before custom properties
318 "custom-property-empty-line-before"?: matchN(1, [
319 null,
320 "always" | "never",
321 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
322 "always" | "never",
323 #coreRule & {
324 // Reverse the primary option for custom properties that come after a comment,
325 // custom property or first child of their parent node
326 except?: list.UniqueItems() & list.MinItems(1) & [
327 ..."after-comment" | "after-custom-property" | "first-nested"
328 ]
329
330 // Ignore custom properties that are preceded by comments or inside single-line blocks
331 ignore?: list.UniqueItems() & list.MinItems(1) & [..."after-comment" | "inside-single-line-block"]
332 ...
333 }
334 ])]
335 ])
336 "custom-property-no-outside-root"?: #booleanRule
337 "custom-property-pattern"?: #stringRule
338
339 // Disallow unknown custom properties
340 "no-unknown-custom-properties"?: matchN(1, [
341 matchN(1, [true, null]),
342 list.MaxItems(2) & {
343 [matchN(1, [true, null]), ...]
344 [1]: #coreRule
345 }
346 ])
347 ...
348 }
349
350 #declaration: null | bool | number | string | [...] | {
351 "declaration-bang-space-after"?: #alwaysNeverRule
352 "declaration-bang-space-before"?: #alwaysNeverRule
353 "declaration-colon-newline-after"?: #alwaysMultiLineRule
354
355 // Require a single space or disallow whitespace after the colon of declarations
356 "declaration-colon-space-after"?: matchN(1, [
357 null,
358 "always" | "never" | "always-single-line",
359 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [
360 ...matchN(>=1, ["always" | "never" | "always-single-line", #coreRule])
361 ]
362 ])
363 "declaration-colon-space-before"?: #alwaysNeverRule
364
365 // Require or disallow an empty line before declarations
366 "declaration-empty-line-before"?: matchN(1, [
367 null,
368 "always" | "never",
369 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
370 "always" | "never",
371 #coreRule & {
372 except?: list.MinItems(1) & list.UniqueItems() & [
373 ..."after-comment" | "after-declaration" | "first-nested"
374 ]
375 ignore?: list.MinItems(1) & list.UniqueItems() & [
376 ..."after-comment" | "after-declaration" | "first-nested" | "inside-single-line-block"
377 ]
378 ...
379 }
380 ])]
381 ])
382 "declaration-no-important"?: #booleanRule
383 "declaration-property-unit-blacklist"?: #objectRule
384 "declaration-property-unit-whitelist"?: #objectRule
385 "declaration-property-value-blacklist"?: #objectRule
386
387 // Disallow unknown values for properties within declarations
388 "declaration-property-value-no-unknown"?: matchN(1, [
389 matchN(1, [true, null]),
390 list.MaxItems(2) & {
391 [matchN(1, [true, null]), ...]
392 [1]: #coreRule & {
393 ignoreProperties?: [string]: matchN(>=1, [matchN(1, [string, [...string]]), matchN(1, [
394 matchN(1, [{...}, =~"^\\/.+\\/i?$"]), [...matchN(>=1, [{...}, =~"^\\/.+\\/i?$"])],
395 ])])
396 propertiesSyntax?: [string]: matchN(1, [string, [...string]])
397 typesSyntax?: [string]: matchN(1, [string, [...string]])
398 ...
399 }
400 }
401 ])
402 "declaration-property-value-whitelist"?: #objectRule
403 ...
404 }
405
406 #declarationBlock: null | bool | number | string | [...] | {
407 // Disallow duplicate properties within declaration blocks
408 "declaration-block-no-duplicate-properties"?: matchN(1, [
409 null,
410 true,
411 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
412 true,
413 #coreRule & {
414 ignore?: list.MinItems(1) & list.UniqueItems() & [
415 ..."consecutive-duplicates" |
416 "consecutive-duplicates-with-different-values" |
417 "consecutive-duplicates-with-different-syntaxes" |
418 "consecutive-duplicates-with-same-prefixless-values"
419 ]
420 ignoreProperties?: #simpleArrayStringRule
421 ...
422 }
423 ])]
424 ])
425 "declaration-block-no-ignored-properties"?: #booleanRule
426
427 // Disallow longhand properties that can be combined into one shorthand property
428 "declaration-block-no-redundant-longhand-properties"?: matchN(1, [
429 null,
430 true,
431 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
432 true,
433 #coreRule & {
434 ignoreShorthands?: #simpleArrayStringRule
435 ...
436 }
437 ])]
438 ])
439 "declaration-block-no-shorthand-property-overrides"?: #booleanRule
440
441 // Specify the order of properties within declaration blocks
442 "declaration-block-properties-order"?: matchN(1, [
443 null,
444 "alphabetical",
445 list.MinItems(1) & list.UniqueItems() & [...matchN(>=1, [
446 "alphabetical",
447 string,
448 #simpleArrayStringRule,
449 #coreRule & {
450 order?: _
451 if order != _|_ {
452 properties!: _
453 }
454 properties?: _
455 if properties != _|_ {
456 order!: _
457 }
458 {}
459
460 // These options only apply if you've defined your own array of properties
461 unspecified?: "top" | "bottom" | "bottomAlphabetical" | "ignore"
462 "order"?: "strict" | "flexible"
463 "properties"?: #simpleArrayStringRule
464 ...
465 }
466 ])]
467 ])
468 "declaration-block-semicolon-newline-after"?: #newlineRule
469 "declaration-block-semicolon-newline-before"?: #newlineRule
470 "declaration-block-semicolon-space-after"?: #spaceRule
471 "declaration-block-semicolon-space-before"?: #spaceRule
472 "declaration-block-single-line-max-declarations"?: #integerRule
473 "declaration-block-trailing-semicolon"?: #alwaysNeverRule
474 ...
475 }
476
477 #font: null | bool | number | string | [...] | {
478 // Specify whether or not quotation marks should be used around font family names
479 "font-family-name-quotes"?: matchN(1, [
480 null,
481 "always-where-required" | "always-where-recommended" | "always-unless-keyword",
482 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [
483 ...matchN(>=1, [
484 "always-where-required" | "always-where-recommended" | "always-unless-keyword",
485 #coreRule,
486 ])
487 ]
488 ])
489
490 // Require numeric or named (where possible) `font-weight` values. Also, when
491 // named values are expected, require only valid names
492 "font-weight-notation"?: matchN(1, [
493 null,
494 "numeric" | "named-where-possible",
495 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
496 "numeric" | "named-where-possible",
497 #coreRule & {
498 ignore?: list.UniqueItems() & list.MinItems(1) & [..."relative"]
499 ...
500 }
501 ])]
502 ])
503 ...
504 }
505
506 #function: null | bool | number | string | [...] | {
507 "function-blacklist"?: #arrayStringRule
508 "function-calc-no-unspaced-operator"?: #booleanRule
509 "function-comma-newline-after"?: #newlineRule
510 "function-comma-newline-before"?: #newlineRule
511 "function-comma-space-after"?: #spaceRule
512 "function-comma-space-before"?: #spaceRule
513 "function-linear-gradient-no-nonstandard-direction"?: #booleanRule
514 "function-max-empty-lines"?: #integerRule
515
516 // Specify lowercase or uppercase for function names
517 "function-name-case"?: matchN(1, [
518 null,
519 "lower" | "upper",
520 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
521 "lower" | "upper",
522 #coreRule & {
523 ignoreFunctions?: #simpleArrayStringRule
524 ...
525 }
526 ])]
527 ])
528 "function-parentheses-newline-inside"?: #newlineRule
529 "function-parentheses-space-inside"?: #spaceRule
530 "function-url-data-uris"?: #alwaysNeverRule
531 "function-url-no-scheme-relative"?: #booleanRule
532 "function-url-quotes"?: #alwaysNeverRule
533 "function-url-scheme-whitelist"?: #arrayStringRule
534 "function-whitelist"?: #arrayStringRule
535 "function-whitespace-after"?: #alwaysNeverRule
536 ...
537 }
538
539 #generalSheet: null | bool | number | string | [...] | {
540 // Specify indentation
541 indentation?: matchN(1, [
542 null | int,
543 "tab",
544 list.MinItems(1) & list.UniqueItems() & [...int],
545 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
546 int,
547 "tab",
548 #coreRule & {
549 // If `true`, the closing brace of a block (rule or at-rule) will be expected at
550 // the same indentation level as the block's inner nodes
551 indentInsideParens?: "twice" | "once-at-root-twice-in-block"
552
553 // Do not indent for these things
554 except?: list.UniqueItems() & list.MinItems(1) & [..."block" | "param" | "value"]
555
556 // Ignore the indentation inside parentheses
557 ignore?: list.UniqueItems() & list.MinItems(1) & [..."inside-parens" | "param" | "value"]
558 ...
559 }
560 ]) &
561 (int | string | {...})]
562 ]) &
563 (null | int | string | [...])
564
565 // Specify unix or windows linebreaks
566 linebreaks?: _
567 "max-empty-lines"?: #integerRule
568
569 // Limit the length of a line
570 "max-line-length"?: matchN(1, [
571 null | int,
572 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
573 int,
574 #coreRule & {
575 ignore?: matchN(>=1, [
576 "non-comments" | "comments",
577 list.UniqueItems() & list.MinItems(1) & [..."non-comments" | "comments"],
578 ])
579 ...
580 }
581 ]) &
582 (int | {...})]
583 ]) &
584 (null | int | [...])
585
586 // Limit the allowed nesting depth
587 "max-nesting-depth"?: matchN(1, [
588 null | int,
589 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
590 int,
591 #coreRule & {
592 ignore?: list.UniqueItems() & list.MinItems(1) & [
593 ..."at-rules-without-declaration-blocks" | "blockless-at-rules" | "pseudo-classes"
594 ]
595 ignoreAtRules?: #simpleArrayStringRule
596 ...
597 }
598 ]) &
599 (int | {...})]
600 ]) &
601 (null | int | [...])
602
603 // Disallow browser hacks that are irrelevant to the browsers you are targeting
604 "no-browser-hacks"?: matchN(1, [
605 null,
606 true,
607 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
608 true,
609 #coreRule & {
610 browsers?: #simpleStringOrArrayStringRule
611 ...
612 }
613 ])]
614 ])
615 "no-descending-specificity"?: #booleanRule
616 "no-duplicate-selectors"?: #booleanRule
617
618 // Disallow empty first lines
619 "no-empty-first-line"?: _
620 "no-empty-source"?: #booleanRule
621
622 // Disallow end-of-line whitespace
623 "no-eol-whitespace"?: matchN(1, [
624 null,
625 true,
626 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
627 true,
628 #coreRule & {
629 ignore?: list.UniqueItems() & list.MinItems(1) & [..."empty-lines"]
630 ...
631 }
632 ])]
633 ])
634 "no-extra-semicolons"?: #booleanRule
635
636 // Disallow colors that are suspiciously close to being identical
637 "no-indistinguishable-colors"?: matchN(1, [
638 null,
639 true,
640 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
641 true,
642 #coreRule & {
643 threshold?: int & >=0 & <=100
644 ignore?: #simpleArrayStringRule
645
646 // An array of color pairs to ignore. Each pair is an array with two items
647 whitelist?: list.UniqueItems() & list.MinItems(1) & [...#simpleArrayStringRule]
648 ...
649 }
650 ])]
651 ])
652 "no-invalid-double-slash-comments"?: #booleanRule
653 "no-missing-end-of-source-newline"?: #booleanRule
654 "no-unknown-animations"?: #booleanRule
655 "unicode-bom"?: #alwaysNeverRule
656
657 // Disallow features that are unsupported by the browsers that you are targeting
658 "no-unsupported-browser-features"?: matchN(1, [
659 null,
660 true,
661 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
662 true,
663 #coreRule & {
664 browsers?: string
665 ignore?: #simpleStringOrArrayStringRule
666 ...
667 }
668 ])]
669 ])
670 ...
671 }
672
673 #integerRule: matchN(1, [
674 null | int,
675 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...#coreRule & (int | {...})]
676 ]) &
677 (null | int | [...])
678
679 #keyframeDeclaration: null | bool | number | string | [...] | {
680 "keyframe-declaration-no-important"?: #booleanRule
681 ...
682 }
683
684 #length: null | bool | number | string | [...] | {
685 "length-zero-no-unit"?: #booleanRule
686 ...
687 }
688
689 #lightness: null | bool | number | string | [...] | {
690 // Specify number or percentage notation for lightness
691 "lightness-notation"?: matchN(1, [
692 matchN(1, ["percentage" | "number", null]),
693 list.MaxItems(2) & {
694 [matchN(1, ["percentage" | "number", null]), ...]
695 [1]: #coreRule
696 }
697 ])
698 ...
699 }
700
701 #lowerUpperRule: matchN(1, [
702 null,
703 "lower" | "upper",
704 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, ["lower" | "upper", #coreRule])]
705 ])
706
707 #mediaFeature: null | bool | number | string | [...] | {
708 "media-feature-colon-space-after"?: #alwaysNeverRule
709 "media-feature-colon-space-before"?: #alwaysNeverRule
710 "media-feature-name-case"?: #lowerUpperRule
711
712 // Disallow unknown media feature names
713 "media-feature-name-no-unknown"?: matchN(1, [
714 null,
715 true,
716 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
717 true,
718 #coreRule & {
719 ignoreMediaFeatureNames?: #simpleArrayStringRule
720 ...
721 }
722 ])]
723 ])
724
725 // Disallow unknown values for media features
726 "media-feature-name-value-no-unknown"?: matchN(1, [
727 matchN(1, [true, null]),
728 list.MaxItems(2) & {
729 [matchN(1, [true, null]), ...]
730 [1]: #coreRule
731 }
732 ])
733 "media-feature-name-no-vendor-prefix"?: #booleanRule
734
735 // Specify a list of allowed name and unit pairs within media features
736 "media-feature-name-unit-allowed-list"?: matchN(1, [
737 matchN(1, [{[string]: matchN(1, [string, [...string]])}, null]),
738 list.MaxItems(2) & {
739 [matchN(1, [{[string]: matchN(1, [string, [...string]])}, null]), ...]
740 [1]: #coreRule
741 }
742 ])
743 "media-feature-no-missing-punctuation"?: #booleanRule
744 "media-feature-parentheses-space-inside"?: #alwaysNeverRule
745
746 // Specify context or prefix notation for media feature ranges
747 "media-feature-range-notation"?: matchN(1, [
748 matchN(1, ["prefix" | "context", null]),
749 list.MaxItems(2) & {
750 [matchN(1, ["prefix" | "context", null]), ...]
751 [1]: #coreRule
752 }
753 ])
754 "media-feature-range-operator-space-after"?: #alwaysNeverRule
755 "media-feature-range-operator-space-before"?: #alwaysNeverRule
756 ...
757 }
758
759 #mediaQuery: null | bool | number | string | [...] | {
760 // Disallow invalid media queries
761 "media-query-no-invalid"?: matchN(1, [
762 matchN(1, [true, null]),
763 list.MaxItems(2) & {
764 [matchN(1, [true, null]), ...]
765 [1]: #coreRule
766 }
767 ])
768 ...
769 }
770
771 #mediaQueryList: null | bool | number | string | [...] | {
772 "media-query-list-comma-newline-after"?: #newlineRule
773 "media-query-list-comma-newline-before"?: #newlineRule
774 "media-query-list-comma-space-after"?: #spaceRule
775 "media-query-list-comma-space-before"?: #spaceRule
776 ...
777 }
778
779 #newlineRule: matchN(1, [
780 null,
781 "always" | "always-multi-line" | "never-multi-line",
782 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [
783 ...matchN(>=1, ["always" | "always-multi-line" | "never-multi-line", #coreRule])
784 ]
785 ])
786
787 #newlineSpaceRule: matchN(1, [
788 null,
789 "always" | "never" | "always-single-line" | "never-single-line" | "always-multi-line" | "never-multi-line",
790 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [
791 ...matchN(>=1, [
792 "always" |
793 "never" |
794 "always-single-line" |
795 "never-single-line" |
796 "always-multi-line" |
797 "never-multi-line",
798 #coreRule,
799 ])
800 ]
801 ])
802
803 #newlineSpaceWithIgnoreRule: matchN(1, [
804 null,
805 "always" | "never" | "always-single-line" | "never-single-line" | "always-multi-line" | "never-multi-line",
806 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
807 "always" | "always-single-line" | "never-single-line" | "always-multi-line" | "never-multi-line",
808 #coreRule & {
809 ignoreAtRules?: #simpleStringOrArrayStringRule
810 ...
811 }
812 ])]
813 ])
814
815 #number: null | bool | number | string | [...] | {
816 "number-leading-zero"?: #alwaysNeverRule
817 "number-max-precision"?: #integerRule
818 "number-no-trailing-zeros"?: #booleanRule
819 ...
820 }
821
822 #objectRule: matchN(1, [
823 null,
824 {[string]: #simpleStringOrArrayStringRule},
825 list.MaxItems(2) & [{[string]: #simpleStringOrArrayStringRule}, #coreRule, ...],
826 ])
827
828 #property: null | bool | number | string | [...] | {
829 "property-blacklist"?: #arrayStringRule
830 "property-case"?: #lowerUpperRule
831
832 // Disallow unknown properties
833 "property-no-unknown"?: matchN(1, [
834 null,
835 true,
836 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
837 true,
838 #coreRule & {
839 ignoreProperties?: #simpleArrayStringRule
840
841 // If `true`, this rule will check vendor-prefixed properties
842 checkPrefixed?: bool
843 ...
844 }
845 ])]
846 ])
847 "property-no-vendor-prefix"?: #booleanRule
848 "property-whitelist"?: #arrayStringRule
849 ...
850 }
851
852 #rootRule: null | bool | number | string | [...] | {
853 "root-no-standard-properties"?: #booleanRule
854 ...
855 }
856
857 #rule: null | bool | number | string | [...] | {
858 // Require or disallow an empty line before nested rules
859 "rule-nested-empty-line-before"?: matchN(1, [
860 null,
861 "always" | "never" | "always-multi-line" | "never-multi-line",
862 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
863 "always" | "never" | "always-multi-line" | "never-multi-line",
864 #coreRule & {
865 // Reverse the primary option if the rule is the first in a block
866 except?: list.UniqueItems() & list.MinItems(1) & [..."first-nested"]
867
868 // Ignore rules that come after a comment
869 ignore?: list.UniqueItems() & list.MinItems(1) & [..."after-comment"]
870 ...
871 }
872 ])]
873 ])
874
875 // Require or disallow an empty line before non-nested rules
876 "rule-non-nested-empty-line-before"?: matchN(1, [
877 null,
878 "always" | "never" | "always-multi-line" | "never-multi-line",
879 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
880 "always" | "never" | "always-multi-line" | "never-multi-line",
881 #coreRule & {
882 // Reverse the primary option if the rule is the first in a block
883 except?: list.UniqueItems() & list.MinItems(1) & [..."after-single-line-comment"]
884
885 // Ignore rules that come after a comment
886 ignore?: list.UniqueItems() & list.MinItems(1) & [..."after-comment"]
887 ...
888 }
889 ])]
890 ])
891 ...
892 }
893
894 #selector: null | bool | number | string | [...] | {
895 // Disallow unmatchable An+B selectors
896 "selector-anb-no-unmatchable"?: matchN(1, [
897 matchN(1, [true, null]),
898 list.MaxItems(2) & {
899 [matchN(1, [true, null]), ...]
900 [1]: #coreRule
901 }
902 ])
903 "selector-attribute-brackets-space-inside"?: #alwaysNeverRule
904 "selector-attribute-operator-blacklist"?: #arrayStringRule
905 "selector-attribute-operator-space-after"?: #alwaysNeverRule
906 "selector-attribute-operator-space-before"?: #alwaysNeverRule
907 "selector-attribute-operator-whitelist"?: #arrayStringRule
908 "selector-attribute-quotes"?: #alwaysNeverRule
909
910 // Specify a pattern for class selectors
911 "selector-class-pattern"?: matchN(1, [
912 null | string,
913 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
914 string,
915 #coreRule & {
916 // This option will resolve nested selectors with `&` interpolation
917 resolveNestedSelectors?: bool
918 ...
919 }
920 ])]
921 ])
922 "selector-combinator-space-after"?: #alwaysNeverRule
923 "selector-combinator-space-before"?: #alwaysNeverRule
924 "selector-descendant-combinator-no-non-space"?: #booleanRule
925 "selector-id-pattern"?: #stringRule
926 "selector-max-compound-selectors"?: #integerRule
927 "selector-max-specificity"?: #stringRule
928 "selector-nested-pattern"?: #stringRule
929 "selector-no-attribute"?: #booleanRule
930 "selector-no-combinator"?: #booleanRule
931 "selector-no-id"?: #booleanRule
932
933 // Disallow qualifying a selector by type
934 "selector-no-qualifying-type"?: matchN(1, [
935 null,
936 true,
937 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
938 true,
939 #coreRule & {
940 ignore?: list.UniqueItems() & list.MinItems(1) & [..."attribute" | "class" | "id"]
941 ...
942 }
943 ])]
944 ])
945
946 // Disallow type selectors
947 "selector-no-type"?: matchN(1, [
948 null,
949 true,
950 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
951 true,
952 #coreRule & {
953 ignore?: list.UniqueItems() & list.MinItems(1) & [..."compounded" | "descendant"]
954 ignoreTypes?: #simpleArrayStringRule
955 ...
956 }
957 ])]
958 ])
959 "selector-no-universal"?: #booleanRule
960 "selector-no-vendor-prefix"?: #booleanRule
961 "selector-pseudo-class-case"?: #lowerUpperRule
962
963 // Disallow unknown pseudo-class selectors
964 "selector-pseudo-class-no-unknown"?: matchN(1, [
965 null,
966 true,
967 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
968 true,
969 #coreRule & {
970 ignorePseudoClasses?: #simpleArrayStringRule
971 ...
972 }
973 ])]
974 ])
975 "selector-pseudo-class-parentheses-space-inside"?: #alwaysNeverRule
976 "selector-pseudo-class-whitelist"?: #arrayStringRule
977 "selector-pseudo-element-case"?: #lowerUpperRule
978 "selector-pseudo-element-colon-notation"?: #singleDoubleRule
979
980 // Disallow unknown pseudo-element selectors
981 "selector-pseudo-element-no-unknown"?: matchN(1, [
982 null,
983 true,
984 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
985 true,
986 #coreRule & {
987 ignorePseudoElements?: #simpleArrayStringRule
988 ...
989 }
990 ])]
991 ])
992 "selector-root-no-composition"?: #booleanRule
993 "selector-type-case"?: #lowerUpperRule
994
995 // Disallow unknown type selectors
996 "selector-type-no-unknown"?: matchN(1, [
997 null,
998 true,
999 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
1000 true,
1001 #coreRule & {
1002 ignoreTypes?: #simpleArrayStringRule
1003 ...
1004 }
1005 ])]
1006 ])
1007 "selector-max-empty-lines"?: #integerRule
1008 ...
1009 }
1010
1011 #selectorList: null | bool | number | string | [...] | {
1012 "selector-list-comma-newline-after"?: #newlineRule
1013 "selector-list-comma-newline-before"?: #newlineRule
1014 "selector-list-comma-space-after"?: #spaceRule
1015 "selector-list-comma-space-before"?: #spaceRule
1016 ...
1017 }
1018
1019 #shorthandProperty: null | bool | number | string | [...] | {
1020 "shorthand-property-no-redundant-values"?: #booleanRule
1021 ...
1022 }
1023
1024 #simpleArrayStringRule: list.UniqueItems() & [...string]
1025
1026 #simpleStringOrArrayStringRule: matchN(1, [string, #simpleArrayStringRule])
1027
1028 #singleDoubleRule: matchN(1, [
1029 null,
1030 "single" | "double",
1031 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, ["single" | "double", #coreRule])]
1032 ])
1033
1034 #spaceRule: matchN(1, [
1035 null,
1036 "always" | "never" | "always-single-line" | "never-single-line",
1037 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [
1038 ...matchN(>=1, ["always" | "never" | "always-single-line" | "never-single-line", #coreRule])
1039 ]
1040 ])
1041
1042 #string: null | bool | number | string | [...] | {
1043 "string-no-newline"?: #booleanRule
1044 "string-quotes"?: #singleDoubleRule
1045 ...
1046 }
1047
1048 #stringRule: matchN(1, [
1049 null | string,
1050 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [string, #coreRule])]
1051 ])
1052
1053 #stylelintDisableComment: null | bool | number | string | [...] | {
1054 // Require a reason comment before or after `stylelint-disable` comments
1055 "stylelint-disable-reason"?: matchN(1, [
1056 null,
1057 "always-before" | "always-after",
1058 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [
1059 ...matchN(>=1, ["always-before" | "always-after", #coreRule])
1060 ]
1061 ])
1062 ...
1063 }
1064
1065 #time: null | bool | number | string | [...] | {
1066 "time-no-imperceptible"?: #booleanRule
1067 ...
1068 }
1069
1070 #unit: null | bool | number | string | [...] | {
1071 "unit-blacklist"?: #unitRule
1072 "unit-case"?: #lowerUpperRule
1073
1074 // Disallow unknown units
1075 "unit-no-unknown"?: matchN(1, [
1076 null,
1077 true,
1078 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
1079 true,
1080 #coreRule & {
1081 ignoreUnits?: #simpleArrayStringRule
1082 ...
1083 }
1084 ])]
1085 ])
1086 "unit-whitelist"?: #unitRule
1087 ...
1088 }
1089
1090 #unitRule: matchN(1, [
1091 null,
1092 "em" |
1093 "ex" |
1094 "px" |
1095 "%" |
1096 "rem" |
1097 "vw" |
1098 "vh" |
1099 "vm" |
1100 "vmin" |
1101 "vmax" |
1102 "ch" |
1103 "in" |
1104 "cm" |
1105 "mm" |
1106 "q" |
1107 "pt" |
1108 "pc" |
1109 "deg" |
1110 "grad" |
1111 "rad" |
1112 "turn" |
1113 "ms" |
1114 "s" |
1115 "Hz" |
1116 "kHz" |
1117 "dpi" |
1118 "dpcm" |
1119 "dppx" |
1120 "fr",
1121 list.MinItems(1) & list.UniqueItems() & [...matchN(>=1, [
1122 "em" |
1123 "ex" |
1124 "px" |
1125 "%" |
1126 "rem" |
1127 "vw" |
1128 "vh" |
1129 "vm" |
1130 "vmin" |
1131 "vmax" |
1132 "ch" |
1133 "in" |
1134 "cm" |
1135 "mm" |
1136 "q" |
1137 "pt" |
1138 "pc" |
1139 "deg" |
1140 "grad" |
1141 "rad" |
1142 "turn" |
1143 "ms" |
1144 "s" |
1145 "Hz" |
1146 "kHz" |
1147 "dpi" |
1148 "dpcm" |
1149 "dppx" |
1150 "fr",
1151 list.UniqueItems() & list.MinItems(1) & [
1152 ..."em" |
1153 "ex" |
1154 "px" |
1155 "%" |
1156 "rem" |
1157 "vw" |
1158 "vh" |
1159 "vm" |
1160 "vmin" |
1161 "vmax" |
1162 "ch" |
1163 "in" |
1164 "cm" |
1165 "mm" |
1166 "q" |
1167 "pt" |
1168 "pc" |
1169 "deg" |
1170 "grad" |
1171 "rad" |
1172 "turn" |
1173 "ms" |
1174 "s" |
1175 "Hz" |
1176 "kHz" |
1177 "dpi" |
1178 "dpcm" |
1179 "dppx" |
1180 "fr"
1181 ],
1182 #coreRule & {
1183 // Ignore units in the values of declarations with the specified properties
1184 ignoreProperties?: {
1185 {[=~"(em|ex|ch|vw|vh|cm|mm|in|pt|pc|px|rem|vmin|vmax|%)"]: #simpleArrayStringRule}
1186 ...
1187 }
1188 ...
1189 }
1190 ])]
1191 ])
1192
1193 #value: null | bool | number | string | [...] | {
1194 // Specify lowercase or uppercase for keywords values
1195 "value-keyword-case"?: matchN(1, [
1196 null,
1197 "lower" | "upper",
1198 list.MinItems(2) & list.MaxItems(2) & list.UniqueItems() & [...matchN(>=1, [
1199 "lower" | "upper",
1200 #coreRule & {
1201 ignoreKeywords?: #simpleArrayStringRule
1202 ...
1203 }
1204 ])]
1205 ])
1206 "value-no-vendor-prefix"?: #booleanRule
1207 ...
1208 }
1209
1210 #valueList: null | bool | number | string | [...] | {
1211 "value-list-comma-newline-after"?: #newlineRule
1212 "value-list-comma-newline-before"?: #newlineRule
1213 "value-list-comma-space-after"?: #spaceRule
1214 "value-list-comma-space-before"?: #spaceRule
1215 "value-list-max-empty-lines"?: #integerRule
1216 ...
1217 }
1218 ...
1219}