UNPKG

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