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
19 // particular glob patterns.
20 "overrides"?: [...{
21 "files"?: [...string]
22 "customSyntax"?: string
23 "rules"?: #allRules
24 ...
25 }]
26
27 // Processors are functions that hook into stylelint's pipeline,
28 // modifying code on its way into stylelint and modifying results
29 // on their way out
30 "processors"?: [...matchN(>=1, [string, [string, ...{
31 ...
32 }]])]
33
34 // Ignore stylelint-disable (e.g. /* stylelint-disable
35 // block-no-empty */) comments.
36 "ignoreDisables"?: bool
37 "ignoreFiles"?: #simpleStringOrArrayStringRule
38
39 // The default severity level for all rules that do not have a
40 // severity specified in their secondary options
41 "defaultSeverity"?: "warning" | "error"
42 "reportDescriptionlessDisables"?: #booleanRule
43 "reportInvalidScopeDisables"?: #booleanRule
44 "reportNeedlessDisables"?: #booleanRule
45 "rules"?: #allRules
46 ...
47
48 #allRules: matchN(30, [#atRule & {
49 ...
50 }, #block & {
51 ...
52 }, #color & {
53 ...
54 }, #comment & {
55 ...
56 }, #customMedia & {
57 ...
58 }, #customProperty & {
59 ...
60 }, #declaration & {
61 ...
62 }, #declarationBlock & {
63 ...
64 }, #font & {
65 ...
66 }, #function & {
67 ...
68 }, #generalSheet & {
69 ...
70 }, #keyframeDeclaration & {
71 ...
72 }, #length & {
73 ...
74 }, #lightness & {
75 ...
76 }, #mediaFeature & {
77 ...
78 }, #mediaQuery & {
79 ...
80 }, #mediaQueryList & {
81 ...
82 }, #number & {
83 ...
84 }, #property & {
85 ...
86 }, #rootRule & {
87 ...
88 }, #rule & {
89 ...
90 }, #selector & {
91 ...
92 }, #selectorList & {
93 ...
94 }, #shorthandProperty & {
95 ...
96 }, #string & {
97 ...
98 }, #stylelintDisableComment & {
99 ...
100 }, #time & {
101 ...
102 }, #unit & {
103 ...
104 }, #value & {
105 ...
106 }, #valueList & {
107 ...
108 }])
109
110 #alwaysMultiLineRule: matchN(1, [null, "always" | "always-multi-line", list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, ["always" | "always-multi-line", #coreRule & (string | {
111 ...
112 })])]])
113
114 #alwaysNeverRule: matchN(1, [null, "always" | "never", list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, ["always" | "never", #coreRule & (string | {
115 ...
116 })])]])
117
118 #arrayStringRule: matchN(1, [null | string, list.UniqueItems() & [_, ...] & [...matchN(>=1, [#simpleArrayStringRule & (string | [...] | {
119 ...
120 }), #coreRule & (string | [...] | {
121 ...
122 })])]])
123
124 #atRule: null | bool | number | string | [...] | {
125 "at-rule-blacklist"?: #arrayStringRule
126
127 // Require or disallow an empty line before at-rules
128 "at-rule-empty-line-before"?: matchN(1, [null, "always" | "never", list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, ["always" | "never", #coreRule & {
129 ...
130 } & {
131 "except"?: list.UniqueItems() & [_, ...] & [..."all-nested" | "after-same-name" | "inside-block" | "blockless-after-same-name-blockless" | "blockless-after-blockless" | "first-nested"]
132 "ignore"?: list.UniqueItems() & [_, ...] & [..."after-comment" | "first-nested" | "inside-block" | "blockless-after-same-name-blockless" | "blockless-after-blockless"]
133 "ignoreAtRules"?: #simpleStringOrArrayStringRule
134 ...
135 }])]])
136 "at-rule-name-case"?: #lowerUpperRule
137 "at-rule-name-newline-after"?: #alwaysMultiLineRule
138
139 // Require a single space after at-rule names
140 "at-rule-name-space-after"?: matchN(1, [null, "always" | "always-single-line", list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, ["always" | "always-single-line", #coreRule & (string | {
141 ...
142 })])]])
143
144 // Disallow unknown at-rules
145 "at-rule-no-unknown"?: matchN(1, [null, true, list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, [true, #coreRule & {
146 ...
147 } & {
148 "ignoreAtRules"?: #simpleArrayStringRule
149 ...
150 }])]])
151 "at-rule-no-vendor-prefix"?: #booleanRule
152
153 // Require a newline after the semicolon of at-rules
154 "at-rule-semicolon-newline-after"?: matchN(1, [null, "always", list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, ["always", #coreRule & (string | {
155 ...
156 })])]])
157
158 // Require a single space or disallow whitespace before the
159 // semicolons of at-rules
160 "at-rule-semicolon-space-before"?: _
161 "at-rule-whitelist"?: #arrayStringRule
162 ...
163 }
164
165 #block: null | bool | number | string | [...] | {
166 // Require or disallow an empty line before the closing brace of
167 // blocks
168 "block-closing-brace-empty-line-before"?: matchN(1, [null, "always-multi-line" | "never", list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, ["always-multi-line" | "never", #coreRule & (string | {
169 ...
170 })])]])
171 "block-closing-brace-newline-after"?: #newlineSpaceWithIgnoreRule
172 "block-closing-brace-newline-before"?: #newlineRule
173 "block-closing-brace-space-after"?: #newlineSpaceRule
174 "block-closing-brace-space-before"?: #newlineSpaceRule
175 "block-no-empty"?: #booleanRule
176 "block-no-single-line"?: #booleanRule
177 "block-opening-brace-newline-after"?: #newlineRule
178
179 // Require a newline or disallow whitespace before the opening
180 // brace of blocks
181 "block-opening-brace-newline-before"?: matchN(1, [null, "always" | "always-single-line" | "never-single-line" | "always-multi-line" | "never-multi-line", list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, ["always" | "always-single-line" | "never-single-line" | "always-multi-line" | "never-multi-line", #coreRule & (string | {
182 ...
183 })])]])
184 "block-opening-brace-space-after"?: #newlineSpaceRule
185 "block-opening-brace-space-before"?: #newlineSpaceWithIgnoreRule
186 ...
187 }
188
189 #booleanRule: matchN(1, [null, bool, list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, [bool, #coreRule & (bool | {
190 ...
191 })])]])
192
193 #color: null | bool | number | string | [...] | {
194 "color-hex-case"?: #lowerUpperRule
195
196 // Specify short or long notation for hex colors
197 "color-hex-length"?: matchN(1, [null, "short" | "long", list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, ["short" | "long", #coreRule & (string | {
198 ...
199 })])]])
200
201 // Require (where possible) or disallow named colors
202 "color-named"?: matchN(1, [null, "always-where-possible" | "never", list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, ["always-where-possible" | "never", #coreRule & {
203 ...
204 } & {
205 "ignore"?: #simpleArrayStringRule
206 ...
207 }])]])
208 "color-no-hex"?: #booleanRule
209 "color-no-invalid-hex"?: #booleanRule
210 ...
211 }
212
213 #comment: null | bool | number | string | [...] | {
214 // Require or disallow an empty line before comments
215 "comment-empty-line-before"?: matchN(1, [null, "always" | "never", list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, ["always" | "never", #coreRule & {
216 ...
217 } & {
218 // Reverse the primary option for comments that are nested and the
219 // first child of their parent node
220 "except"?: list.UniqueItems() & [_, ...] & [..."first-nested"]
221
222 // Don't require an empty line between comments
223 "ignore"?: list.UniqueItems() & [_, ...] & [..."between-comments" | "after-comment" | "stylelint-command" | "stylelint-commands"]
224 ...
225 }])]])
226 "comment-no-empty"?: #booleanRule
227 "comment-whitespace-inside"?: #alwaysNeverRule
228 "comment-word-blacklist"?: #arrayStringRule
229 ...
230 }
231
232 #coreRule: {
233 "disableFix"?: bool
234
235 // Custom message that will be used in errors and warnings
236 "message"?: string
237 "reportDisables"?: bool
238
239 // Message status
240 "severity"?: "warning" | "error"
241 "url"?: net.AbsURL
242 ...
243 }
244
245 #customMedia: null | bool | number | string | [...] | {
246 "custom-media-pattern"?: #stringRule
247
248 // Disallow unknown custom media queries
249 "no-unknown-custom-media"?: matchN(1, [matchN(1, [true, null]), list.MaxItems(2) & [_, ...] & [matchN(1, [true, null]), #coreRule, ...]])
250 ...
251 }
252
253 #customProperty: null | bool | number | string | [...] | {
254 // Require or disallow an empty line before custom properties
255 "custom-property-empty-line-before"?: matchN(1, [null, "always" | "never", list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, ["always" | "never", #coreRule & {
256 ...
257 } & {
258 // Reverse the primary option for custom properties that come
259 // after a comment, custom property or first child of their
260 // parent node
261 "except"?: list.UniqueItems() & [_, ...] & [..."after-comment" | "after-custom-property" | "first-nested"]
262
263 // Ignore custom properties that are preceded by comments or
264 // inside single-line blocks
265 "ignore"?: list.UniqueItems() & [_, ...] & [..."after-comment" | "inside-single-line-block"]
266 ...
267 }])]])
268 "custom-property-no-outside-root"?: #booleanRule
269 "custom-property-pattern"?: #stringRule
270
271 // Disallow unknown custom properties
272 "no-unknown-custom-properties"?: matchN(1, [matchN(1, [true, null]), list.MaxItems(2) & [_, ...] & [matchN(1, [true, null]), #coreRule, ...]])
273 ...
274 }
275
276 #declaration: null | bool | number | string | [...] | {
277 "declaration-bang-space-after"?: #alwaysNeverRule
278 "declaration-bang-space-before"?: #alwaysNeverRule
279 "declaration-colon-newline-after"?: #alwaysMultiLineRule
280
281 // Require a single space or disallow whitespace after the colon
282 // of declarations
283 "declaration-colon-space-after"?: matchN(1, [null, "always" | "never" | "always-single-line", list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, ["always" | "never" | "always-single-line", #coreRule & (string | {
284 ...
285 })])]])
286 "declaration-colon-space-before"?: #alwaysNeverRule
287
288 // Require or disallow an empty line before declarations
289 "declaration-empty-line-before"?: matchN(1, [null, "always" | "never", list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, ["always" | "never", #coreRule & {
290 ...
291 } & {
292 "except"?: list.UniqueItems() & [_, ...] & [..."after-comment" | "after-declaration" | "first-nested"]
293 "ignore"?: list.UniqueItems() & [_, ...] & [..."after-comment" | "after-declaration" | "first-nested" | "inside-single-line-block"]
294 ...
295 }])]])
296 "declaration-no-important"?: #booleanRule
297 "declaration-property-unit-blacklist"?: #objectRule
298 "declaration-property-unit-whitelist"?: #objectRule
299 "declaration-property-value-blacklist"?: #objectRule
300
301 // Disallow unknown values for properties within declarations
302 "declaration-property-value-no-unknown"?: matchN(1, [matchN(1, [true, null]), list.MaxItems(2) & [_, ...] & [matchN(1, [true, null]), #coreRule & {
303 ...
304 } & {
305 "ignoreProperties"?: [string]: matchN(>=1, [matchN(1, [string, [...string]]), matchN(1, [matchN(1, [{
306 ...
307 }, =~"^\\/.+\\/i?$"]), [...matchN(>=1, [{
308 ...
309 }, =~"^\\/.+\\/i?$"])]])])
310 "propertiesSyntax"?: {
311 [string]: matchN(1, [string, [...string]])
312 }
313 "typesSyntax"?: {
314 [string]: matchN(1, [string, [...string]])
315 }
316 ...
317 }, ...]])
318 "declaration-property-value-whitelist"?: #objectRule
319 ...
320 }
321
322 #declarationBlock: null | bool | number | string | [...] | {
323 // Disallow duplicate properties within declaration blocks
324 "declaration-block-no-duplicate-properties"?: matchN(1, [null, true, list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, [true, #coreRule & {
325 ...
326 } & {
327 "ignore"?: list.UniqueItems() & [_, ...] & [..."consecutive-duplicates" | "consecutive-duplicates-with-different-values" | "consecutive-duplicates-with-different-syntaxes" | "consecutive-duplicates-with-same-prefixless-values"]
328 "ignoreProperties"?: #simpleArrayStringRule
329 ...
330 }])]])
331 "declaration-block-no-ignored-properties"?: #booleanRule
332
333 // Disallow longhand properties that can be combined into one
334 // shorthand property
335 "declaration-block-no-redundant-longhand-properties"?: matchN(1, [null, true, list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, [true, #coreRule & {
336 ...
337 } & {
338 "ignoreShorthands"?: #simpleArrayStringRule
339 ...
340 }])]])
341 "declaration-block-no-shorthand-property-overrides"?: #booleanRule
342
343 // Specify the order of properties within declaration blocks
344 "declaration-block-properties-order"?: matchN(1, [null, "alphabetical", list.UniqueItems() & [_, ...] & [...matchN(>=1, ["alphabetical", string, #simpleArrayStringRule & (string | [...] | {
345 ...
346 }), #coreRule & {
347 ...
348 } & {
349 order?: _
350 if order != _|_ {
351 "properties"!: _
352 }
353 properties?: _
354 if properties != _|_ {
355 "order"!: _
356 }
357 {}
358
359 // These options only apply if you've defined your own array of
360 // properties
361 "unspecified"?: "top" | "bottom" | "bottomAlphabetical" | "ignore"
362 "order"?: "strict" | "flexible"
363 "properties"?: #simpleArrayStringRule
364 ...
365 }])]])
366 "declaration-block-semicolon-newline-after"?: #newlineRule
367 "declaration-block-semicolon-newline-before"?: #newlineRule
368 "declaration-block-semicolon-space-after"?: #spaceRule
369 "declaration-block-semicolon-space-before"?: #spaceRule
370 "declaration-block-single-line-max-declarations"?: #integerRule
371 "declaration-block-trailing-semicolon"?: #alwaysNeverRule
372 ...
373 }
374
375 #font: null | bool | number | string | [...] | {
376 // Specify whether or not quotation marks should be used around
377 // font family names
378 "font-family-name-quotes"?: matchN(1, [null, "always-where-required" | "always-where-recommended" | "always-unless-keyword", list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, ["always-where-required" | "always-where-recommended" | "always-unless-keyword", #coreRule & (string | {
379 ...
380 })])]])
381
382 // Require numeric or named (where possible) `font-weight` values.
383 // Also, when named values are expected, require only valid names
384 "font-weight-notation"?: matchN(1, [null, "numeric" | "named-where-possible", list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, ["numeric" | "named-where-possible", #coreRule & {
385 ...
386 } & {
387 "ignore"?: list.UniqueItems() & [_, ...] & [..."relative"]
388 ...
389 }])]])
390 ...
391 }
392
393 #function: null | bool | number | string | [...] | {
394 "function-blacklist"?: #arrayStringRule
395 "function-calc-no-unspaced-operator"?: #booleanRule
396 "function-comma-newline-after"?: #newlineRule
397 "function-comma-newline-before"?: #newlineRule
398 "function-comma-space-after"?: #spaceRule
399 "function-comma-space-before"?: #spaceRule
400 "function-linear-gradient-no-nonstandard-direction"?: #booleanRule
401 "function-max-empty-lines"?: #integerRule
402
403 // Specify lowercase or uppercase for function names
404 "function-name-case"?: matchN(1, [null, "lower" | "upper", list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, ["lower" | "upper", #coreRule & {
405 ...
406 } & {
407 "ignoreFunctions"?: #simpleArrayStringRule
408 ...
409 }])]])
410 "function-parentheses-newline-inside"?: #newlineRule
411 "function-parentheses-space-inside"?: #spaceRule
412 "function-url-data-uris"?: #alwaysNeverRule
413 "function-url-no-scheme-relative"?: #booleanRule
414 "function-url-quotes"?: #alwaysNeverRule
415 "function-url-scheme-whitelist"?: #arrayStringRule
416 "function-whitelist"?: #arrayStringRule
417 "function-whitespace-after"?: #alwaysNeverRule
418 ...
419 }
420
421 #generalSheet: null | bool | number | string | [...] | {
422 // Specify indentation
423 "indentation"?: matchN(1, [null | int, "tab", list.UniqueItems() & [_, ...] & [...int], list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, [int, "tab", #coreRule & {
424 ...
425 } & {
426 // If `true`, the closing brace of a block (rule or at-rule) will
427 // be expected at the same indentation level as the block's inner
428 // nodes
429 "indentInsideParens"?: "twice" | "once-at-root-twice-in-block"
430
431 // Do not indent for these things
432 "except"?: list.UniqueItems() & [_, ...] & [..."block" | "param" | "value"]
433
434 // Ignore the indentation inside parentheses
435 "ignore"?: list.UniqueItems() & [_, ...] & [..."inside-parens" | "param" | "value"]
436 ...
437 }]) & (int | string | {
438 ...
439 })]]) & (null | int | string | [...])
440
441 // Specify unix or windows linebreaks
442 "linebreaks"?: _
443 "max-empty-lines"?: #integerRule
444
445 // Limit the length of a line
446 "max-line-length"?: matchN(1, [null | int, list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, [int, #coreRule & {
447 ...
448 } & {
449 "ignore"?: matchN(>=1, ["non-comments" | "comments", list.UniqueItems() & [_, ...] & [..."non-comments" | "comments"]])
450 ...
451 }]) & (int | {
452 ...
453 })]]) & (null | int | [...])
454
455 // Limit the allowed nesting depth
456 "max-nesting-depth"?: matchN(1, [null | int, list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, [int, #coreRule & {
457 ...
458 } & {
459 "ignore"?: list.UniqueItems() & [_, ...] & [..."at-rules-without-declaration-blocks" | "blockless-at-rules" | "pseudo-classes"]
460 "ignoreAtRules"?: #simpleArrayStringRule
461 ...
462 }]) & (int | {
463 ...
464 })]]) & (null | int | [...])
465
466 // Disallow browser hacks that are irrelevant to the browsers you
467 // are targeting
468 "no-browser-hacks"?: matchN(1, [null, true, list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, [true, #coreRule & {
469 ...
470 } & {
471 "browsers"?: #simpleStringOrArrayStringRule
472 ...
473 }])]])
474 "no-descending-specificity"?: #booleanRule
475 "no-duplicate-selectors"?: #booleanRule
476
477 // Disallow empty first lines
478 "no-empty-first-line"?: _
479 "no-empty-source"?: #booleanRule
480
481 // Disallow end-of-line whitespace
482 "no-eol-whitespace"?: matchN(1, [null, true, list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, [true, #coreRule & {
483 ...
484 } & {
485 "ignore"?: list.UniqueItems() & [_, ...] & [..."empty-lines"]
486 ...
487 }])]])
488 "no-extra-semicolons"?: #booleanRule
489
490 // Disallow colors that are suspiciously close to being identical
491 "no-indistinguishable-colors"?: matchN(1, [null, true, list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, [true, #coreRule & {
492 ...
493 } & {
494 "threshold"?: int & >=0 & <=100
495 "ignore"?: #simpleArrayStringRule
496
497 // An array of color pairs to ignore. Each pair is an array with
498 // two items
499 "whitelist"?: list.UniqueItems() & [_, ...] & [...#simpleArrayStringRule]
500 ...
501 }])]])
502 "no-invalid-double-slash-comments"?: #booleanRule
503 "no-missing-end-of-source-newline"?: #booleanRule
504 "no-unknown-animations"?: #booleanRule
505 "unicode-bom"?: #alwaysNeverRule
506
507 // Disallow features that are unsupported by the browsers that you
508 // are targeting
509 "no-unsupported-browser-features"?: matchN(1, [null, true, list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, [true, #coreRule & {
510 ...
511 } & {
512 "browsers"?: string
513 "ignore"?: #simpleStringOrArrayStringRule
514 ...
515 }])]])
516 ...
517 }
518
519 #integerRule: matchN(1, [null | int, list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...#coreRule & (number | {
520 ...
521 }) & (int | {
522 ...
523 })]]) & (null | int | [...])
524
525 #keyframeDeclaration: null | bool | number | string | [...] | {
526 "keyframe-declaration-no-important"?: #booleanRule
527 ...
528 }
529
530 #length: null | bool | number | string | [...] | {
531 "length-zero-no-unit"?: #booleanRule
532 ...
533 }
534
535 #lightness: null | bool | number | string | [...] | {
536 // Specify number or percentage notation for lightness
537 "lightness-notation"?: matchN(1, [matchN(1, ["percentage" | "number", null]), list.MaxItems(2) & [_, ...] & [matchN(1, ["percentage" | "number", null]), #coreRule, ...]])
538 ...
539 }
540
541 #lowerUpperRule: matchN(1, [null, "lower" | "upper", list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, ["lower" | "upper", #coreRule & (string | {
542 ...
543 })])]])
544
545 #mediaFeature: null | bool | number | string | [...] | {
546 "media-feature-colon-space-after"?: #alwaysNeverRule
547 "media-feature-colon-space-before"?: #alwaysNeverRule
548 "media-feature-name-case"?: #lowerUpperRule
549
550 // Disallow unknown media feature names
551 "media-feature-name-no-unknown"?: matchN(1, [null, true, list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, [true, #coreRule & {
552 ...
553 } & {
554 "ignoreMediaFeatureNames"?: #simpleArrayStringRule
555 ...
556 }])]])
557
558 // Disallow unknown values for media features
559 "media-feature-name-value-no-unknown"?: matchN(1, [matchN(1, [true, null]), list.MaxItems(2) & [_, ...] & [matchN(1, [true, null]), #coreRule, ...]])
560 "media-feature-name-no-vendor-prefix"?: #booleanRule
561
562 // Specify a list of allowed name and unit pairs within media
563 // features
564 "media-feature-name-unit-allowed-list"?: matchN(1, [matchN(1, [{
565 [string]: matchN(1, [string, [...string]])
566 }, null]), list.MaxItems(2) & [_, ...] & [matchN(1, [{
567 [string]: matchN(1, [string, [...string]])
568 }, null]), #coreRule, ...]])
569 "media-feature-no-missing-punctuation"?: #booleanRule
570 "media-feature-parentheses-space-inside"?: #alwaysNeverRule
571
572 // Specify context or prefix notation for media feature ranges
573 "media-feature-range-notation"?: matchN(1, [matchN(1, ["prefix" | "context", null]), list.MaxItems(2) & [_, ...] & [matchN(1, ["prefix" | "context", null]), #coreRule, ...]])
574 "media-feature-range-operator-space-after"?: #alwaysNeverRule
575 "media-feature-range-operator-space-before"?: #alwaysNeverRule
576 ...
577 }
578
579 #mediaQuery: null | bool | number | string | [...] | {
580 // Disallow invalid media queries
581 "media-query-no-invalid"?: matchN(1, [matchN(1, [true, null]), list.MaxItems(2) & [_, ...] & [matchN(1, [true, null]), #coreRule, ...]])
582 ...
583 }
584
585 #mediaQueryList: null | bool | number | string | [...] | {
586 "media-query-list-comma-newline-after"?: #newlineRule
587 "media-query-list-comma-newline-before"?: #newlineRule
588 "media-query-list-comma-space-after"?: #spaceRule
589 "media-query-list-comma-space-before"?: #spaceRule
590 ...
591 }
592
593 #newlineRule: matchN(1, [null, "always" | "always-multi-line" | "never-multi-line", list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, ["always" | "always-multi-line" | "never-multi-line", #coreRule & (string | {
594 ...
595 })])]])
596
597 #newlineSpaceRule: matchN(1, [null, "always" | "never" | "always-single-line" | "never-single-line" | "always-multi-line" | "never-multi-line", list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, ["always" | "never" | "always-single-line" | "never-single-line" | "always-multi-line" | "never-multi-line", #coreRule & (string | {
598 ...
599 })])]])
600
601 #newlineSpaceWithIgnoreRule: matchN(1, [null, "always" | "never" | "always-single-line" | "never-single-line" | "always-multi-line" | "never-multi-line", list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, ["always" | "always-single-line" | "never-single-line" | "always-multi-line" | "never-multi-line", #coreRule & {
602 ...
603 } & {
604 "ignoreAtRules"?: #simpleStringOrArrayStringRule
605 ...
606 }])]])
607
608 #number: null | bool | number | string | [...] | {
609 "number-leading-zero"?: #alwaysNeverRule
610 "number-max-precision"?: #integerRule
611 "number-no-trailing-zeros"?: #booleanRule
612 ...
613 }
614
615 #objectRule: matchN(1, [null, {
616 [string]: #simpleStringOrArrayStringRule
617 }, list.MaxItems(2) & [_, _, ...] & [{
618 [string]: #simpleStringOrArrayStringRule
619 }, #coreRule, ...]])
620
621 #property: null | bool | number | string | [...] | {
622 "property-blacklist"?: #arrayStringRule
623 "property-case"?: #lowerUpperRule
624
625 // Disallow unknown properties
626 "property-no-unknown"?: matchN(1, [null, true, list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, [true, #coreRule & {
627 ...
628 } & {
629 "ignoreProperties"?: #simpleArrayStringRule
630
631 // If `true`, this rule will check vendor-prefixed properties
632 "checkPrefixed"?: bool
633 ...
634 }])]])
635 "property-no-vendor-prefix"?: #booleanRule
636 "property-whitelist"?: #arrayStringRule
637 ...
638 }
639
640 #rootRule: null | bool | number | string | [...] | {
641 "root-no-standard-properties"?: #booleanRule
642 ...
643 }
644
645 #rule: null | bool | number | string | [...] | {
646 // Require or disallow an empty line before nested rules
647 "rule-nested-empty-line-before"?: matchN(1, [null, "always" | "never" | "always-multi-line" | "never-multi-line", list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, ["always" | "never" | "always-multi-line" | "never-multi-line", #coreRule & {
648 ...
649 } & {
650 // Reverse the primary option if the rule is the first in a block
651 "except"?: list.UniqueItems() & [_, ...] & [..."first-nested"]
652
653 // Ignore rules that come after a comment
654 "ignore"?: list.UniqueItems() & [_, ...] & [..."after-comment"]
655 ...
656 }])]])
657
658 // Require or disallow an empty line before non-nested rules
659 "rule-non-nested-empty-line-before"?: matchN(1, [null, "always" | "never" | "always-multi-line" | "never-multi-line", list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, ["always" | "never" | "always-multi-line" | "never-multi-line", #coreRule & {
660 ...
661 } & {
662 // Reverse the primary option if the rule is the first in a block
663 "except"?: list.UniqueItems() & [_, ...] & [..."after-single-line-comment"]
664
665 // Ignore rules that come after a comment
666 "ignore"?: list.UniqueItems() & [_, ...] & [..."after-comment"]
667 ...
668 }])]])
669 ...
670 }
671
672 #selector: null | bool | number | string | [...] | {
673 // Disallow unmatchable An+B selectors
674 "selector-anb-no-unmatchable"?: matchN(1, [matchN(1, [true, null]), list.MaxItems(2) & [_, ...] & [matchN(1, [true, null]), #coreRule, ...]])
675 "selector-attribute-brackets-space-inside"?: #alwaysNeverRule
676 "selector-attribute-operator-blacklist"?: #arrayStringRule
677 "selector-attribute-operator-space-after"?: #alwaysNeverRule
678 "selector-attribute-operator-space-before"?: #alwaysNeverRule
679 "selector-attribute-operator-whitelist"?: #arrayStringRule
680 "selector-attribute-quotes"?: #alwaysNeverRule
681
682 // Specify a pattern for class selectors
683 "selector-class-pattern"?: matchN(1, [null | string, list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, [string, #coreRule & {
684 ...
685 } & {
686 // This option will resolve nested selectors with `&`
687 // interpolation
688 "resolveNestedSelectors"?: bool
689 ...
690 }])]])
691 "selector-combinator-space-after"?: #alwaysNeverRule
692 "selector-combinator-space-before"?: #alwaysNeverRule
693 "selector-descendant-combinator-no-non-space"?: #booleanRule
694 "selector-id-pattern"?: #stringRule
695 "selector-max-compound-selectors"?: #integerRule
696 "selector-max-specificity"?: #stringRule
697 "selector-nested-pattern"?: #stringRule
698 "selector-no-attribute"?: #booleanRule
699 "selector-no-combinator"?: #booleanRule
700 "selector-no-id"?: #booleanRule
701
702 // Disallow qualifying a selector by type
703 "selector-no-qualifying-type"?: matchN(1, [null, true, list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, [true, #coreRule & {
704 ...
705 } & {
706 "ignore"?: list.UniqueItems() & [_, ...] & [..."attribute" | "class" | "id"]
707 ...
708 }])]])
709
710 // Disallow type selectors
711 "selector-no-type"?: matchN(1, [null, true, list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, [true, #coreRule & {
712 ...
713 } & {
714 "ignore"?: list.UniqueItems() & [_, ...] & [..."compounded" | "descendant"]
715 "ignoreTypes"?: #simpleArrayStringRule
716 ...
717 }])]])
718 "selector-no-universal"?: #booleanRule
719 "selector-no-vendor-prefix"?: #booleanRule
720 "selector-pseudo-class-case"?: #lowerUpperRule
721
722 // Disallow unknown pseudo-class selectors
723 "selector-pseudo-class-no-unknown"?: matchN(1, [null, true, list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, [true, #coreRule & {
724 ...
725 } & {
726 "ignorePseudoClasses"?: #simpleArrayStringRule
727 ...
728 }])]])
729 "selector-pseudo-class-parentheses-space-inside"?: #alwaysNeverRule
730 "selector-pseudo-class-whitelist"?: #arrayStringRule
731 "selector-pseudo-element-case"?: #lowerUpperRule
732 "selector-pseudo-element-colon-notation"?: #singleDoubleRule
733
734 // Disallow unknown pseudo-element selectors
735 "selector-pseudo-element-no-unknown"?: matchN(1, [null, true, list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, [true, #coreRule & {
736 ...
737 } & {
738 "ignorePseudoElements"?: #simpleArrayStringRule
739 ...
740 }])]])
741 "selector-root-no-composition"?: #booleanRule
742 "selector-type-case"?: #lowerUpperRule
743
744 // Disallow unknown type selectors
745 "selector-type-no-unknown"?: matchN(1, [null, true, list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, [true, #coreRule & {
746 ...
747 } & {
748 "ignoreTypes"?: #simpleArrayStringRule
749 ...
750 }])]])
751 "selector-max-empty-lines"?: #integerRule
752 ...
753 }
754
755 #selectorList: null | bool | number | string | [...] | {
756 "selector-list-comma-newline-after"?: #newlineRule
757 "selector-list-comma-newline-before"?: #newlineRule
758 "selector-list-comma-space-after"?: #spaceRule
759 "selector-list-comma-space-before"?: #spaceRule
760 ...
761 }
762
763 #shorthandProperty: null | bool | number | string | [...] | {
764 "shorthand-property-no-redundant-values"?: #booleanRule
765 ...
766 }
767
768 #simpleArrayStringRule: list.UniqueItems() & [...string]
769
770 #simpleStringOrArrayStringRule: matchN(1, [string, #simpleArrayStringRule & (string | [...])])
771
772 #singleDoubleRule: matchN(1, [null, "single" | "double", list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, ["single" | "double", #coreRule & (string | {
773 ...
774 })])]])
775
776 #spaceRule: matchN(1, [null, "always" | "never" | "always-single-line" | "never-single-line", list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, ["always" | "never" | "always-single-line" | "never-single-line", #coreRule & (string | {
777 ...
778 })])]])
779
780 #string: null | bool | number | string | [...] | {
781 "string-no-newline"?: #booleanRule
782 "string-quotes"?: #singleDoubleRule
783 ...
784 }
785
786 #stringRule: matchN(1, [null | string, list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, [string, #coreRule & (string | {
787 ...
788 })])]])
789
790 #stylelintDisableComment: null | bool | number | string | [...] | {
791 // Require a reason comment before or after `stylelint-disable`
792 // comments
793 "stylelint-disable-reason"?: matchN(1, [null, "always-before" | "always-after", list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, ["always-before" | "always-after", #coreRule & (string | {
794 ...
795 })])]])
796 ...
797 }
798
799 #time: null | bool | number | string | [...] | {
800 "time-no-imperceptible"?: #booleanRule
801 ...
802 }
803
804 #unit: null | bool | number | string | [...] | {
805 "unit-blacklist"?: #unitRule
806 "unit-case"?: #lowerUpperRule
807
808 // Disallow unknown units
809 "unit-no-unknown"?: matchN(1, [null, true, list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, [true, #coreRule & {
810 ...
811 } & {
812 "ignoreUnits"?: #simpleArrayStringRule
813 ...
814 }])]])
815 "unit-whitelist"?: #unitRule
816 ...
817 }
818
819 #unitRule: matchN(1, [null, "em" | "ex" | "px" | "%" | "rem" | "vw" | "vh" | "vm" | "vmin" | "vmax" | "ch" | "in" | "cm" | "mm" | "q" | "pt" | "pc" | "deg" | "grad" | "rad" | "turn" | "ms" | "s" | "Hz" | "kHz" | "dpi" | "dpcm" | "dppx" | "fr", list.UniqueItems() & [_, ...] & [...matchN(>=1, ["em" | "ex" | "px" | "%" | "rem" | "vw" | "vh" | "vm" | "vmin" | "vmax" | "ch" | "in" | "cm" | "mm" | "q" | "pt" | "pc" | "deg" | "grad" | "rad" | "turn" | "ms" | "s" | "Hz" | "kHz" | "dpi" | "dpcm" | "dppx" | "fr", list.UniqueItems() & [_, ...] & [..."em" | "ex" | "px" | "%" | "rem" | "vw" | "vh" | "vm" | "vmin" | "vmax" | "ch" | "in" | "cm" | "mm" | "q" | "pt" | "pc" | "deg" | "grad" | "rad" | "turn" | "ms" | "s" | "Hz" | "kHz" | "dpi" | "dpcm" | "dppx" | "fr"], #coreRule & {
820 ...
821 } & {
822 // Ignore units in the values of declarations with the specified
823 // properties
824 "ignoreProperties"?: {
825 {[=~"(em|ex|ch|vw|vh|cm|mm|in|pt|pc|px|rem|vmin|vmax|%)"]: #simpleArrayStringRule}
826 ...
827 }
828 ...
829 }])]])
830
831 #value: null | bool | number | string | [...] | {
832 // Specify lowercase or uppercase for keywords values
833 "value-keyword-case"?: matchN(1, [null, "lower" | "upper", list.MaxItems(2) & list.UniqueItems() & [_, _, ...] & [...matchN(>=1, ["lower" | "upper", #coreRule & {
834 ...
835 } & {
836 "ignoreKeywords"?: #simpleArrayStringRule
837 ...
838 }])]])
839 "value-no-vendor-prefix"?: #booleanRule
840 ...
841 }
842
843 #valueList: null | bool | number | string | [...] | {
844 "value-list-comma-newline-after"?: #newlineRule
845 "value-list-comma-newline-before"?: #newlineRule
846 "value-list-comma-space-after"?: #spaceRule
847 "value-list-comma-space-before"?: #spaceRule
848 "value-list-max-empty-lines"?: #integerRule
849 ...
850 }
851}