UNPKG

2.74 kBMarkdownView Raw
1# media-query-list-comma-space-before
2
3Require a single space or disallow whitespace before the commas of media query lists.
4
5<!-- prettier-ignore -->
6```css
7@media screen and (color) ,projection and (color) {}
8/** ↑
9 * The space before this comma */
10```
11
12The [`fix` option](../../../docs/user-guide/usage/options.md#fix) can automatically fix all of the problems reported by this rule.
13
14## Options
15
16`string`: `"always"|"never"|"always-single-line"|"never-single-line"`
17
18### `"always"`
19
20There _must always_ be a single space before the commas.
21
22The following patterns are considered violations:
23
24<!-- prettier-ignore -->
25```css
26@media screen and (color),projection and (color) {}
27```
28
29<!-- prettier-ignore -->
30```css
31@media screen and (color)
32,projection and (color) {}
33```
34
35The following patterns are _not_ considered violations:
36
37<!-- prettier-ignore -->
38```css
39@media screen and (color) ,projection and (color) {}
40```
41
42<!-- prettier-ignore -->
43```css
44@media screen and (color) ,
45projection and (color) {}
46```
47
48### `"never"`
49
50There _must never_ be whitespace before the commas.
51
52The following patterns are considered violations:
53
54<!-- prettier-ignore -->
55```css
56@media screen and (color) ,projection and (color) {}
57```
58
59<!-- prettier-ignore -->
60```css
61@media screen and (color)
62, projection and (color) {}
63```
64
65The following patterns are _not_ considered violations:
66
67<!-- prettier-ignore -->
68```css
69@media screen and (color),projection and (color) {}
70```
71
72<!-- prettier-ignore -->
73```css
74@media screen and (color),
75projection and (color) {}
76```
77
78### `"always-single-line"`
79
80There _must always_ be a single space before the commas in single-line media query lists.
81
82The following patterns are considered violations:
83
84<!-- prettier-ignore -->
85```css
86@media screen and (color),projection and (color) {}
87```
88
89The following patterns are _not_ considered violations:
90
91<!-- prettier-ignore -->
92```css
93@media screen and (color) ,projection and (color) {}
94```
95
96<!-- prettier-ignore -->
97```css
98@media screen and (color)
99, projection and (color) {}
100```
101
102<!-- prettier-ignore -->
103```css
104@media screen and (color)
105,projection and (color) {}
106```
107
108### `"never-single-line"`
109
110There _must never_ be whitespace before the commas in single-line media query lists.
111
112The following patterns are considered violations:
113
114<!-- prettier-ignore -->
115```css
116@media screen and (color) , projection and (color) {}
117```
118
119The following patterns are _not_ considered violations:
120
121<!-- prettier-ignore -->
122```css
123@media screen and (color),projection and (color) {}
124```
125
126<!-- prettier-ignore -->
127```css
128@media screen and (color)
129,projection and (color) {}
130```
131
132<!-- prettier-ignore -->
133```css
134@media screen and (color)
135, projection and (color) {}
136```