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