.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / stylelint / lib / rules / rule-empty-line-before / README.md
1 # rule-empty-line-before
2
3 Require or disallow an empty line before rules.
4
5 ```css
6 a {}
7       /* ← */
8 b {}  /* ↑ */
9 /**      ↑
10  * This line */
11 ```
12
13 If the rule is the very first node in a stylesheet then it is ignored.
14
15 The `--fix` option on the [command line](../../../docs/user-guide/cli.md#autofixing-errors) can automatically fix all of the problems reported by this rule. We recommend to enable [`indentation`](../indentation/README.md) rule for better autofixing results with this rule.
16
17 ## Options
18
19 `string`: `"always"|"never"|"always-multi-line"|"never-multi-line"`
20
21 ### `"always"`
22
23 There *must always* be an empty line before rules.
24
25 The following patterns are considered violations:
26
27 ```css
28 a {} b {}
29 ```
30
31 ```css
32 a {}
33 b {}
34 ```
35
36 The following patterns are *not* considered violations:
37
38 ```css
39 a {}
40
41 b {}
42 ```
43
44 ### `"never"`
45
46 There *must never* be an empty line before rules.
47
48 The following patterns are considered violations:
49
50 ```css
51 a {}
52
53 b {}
54 ```
55
56 The following patterns are *not* considered violations:
57
58 ```css
59 a {} b {}
60 ```
61
62 ```css
63 a {}
64 b {}
65 ```
66
67 ### `"always-multi-line"`
68
69 There *must always* be an empty line before multi-line rules.
70
71 The following patterns are considered violations:
72
73 ```css
74 a {
75   color: red;
76 }
77 b {
78   color: blue;
79 }
80 ```
81
82 The following patterns are *not* considered violations:
83
84 ```css
85 a {
86   color: red;
87 }
88
89 b {
90   color: blue;
91 }
92 ```
93
94 ### `"never-multi-line"`
95
96 There *must never* be an empty line before multi-line rules.
97
98 The following patterns are considered violations:
99
100 ```css
101 a {
102   color: red;
103 }
104
105 b {
106   color: blue;
107 }
108 ```
109
110 The following patterns are *not* considered violations:
111
112 ```css
113 a {
114   color: red;
115 }
116 b {
117   color: blue;
118 }
119 ```
120
121 ## Optional secondary options
122
123 ### `except: ["after-rule", "after-single-line-comment", "inside-block-and-after-rule", "inside-block", "first-nested"]`
124
125 #### `"after-rule"`
126
127 Reverse the primary option if the rule comes after another rule.
128
129 For example, with `"always"`:
130
131 The following patterns are considered violations:
132
133 ```css
134 a {}
135
136 b {}
137 ```
138
139 The following patterns are *not* considered violations:
140
141 ```css
142 a {}
143 b {}
144 ```
145
146 #### `"after-single-line-comment"`
147
148 Reverse the primary option if the rule comes after a single-line comment.
149
150 For example, with `"always"`:
151
152 The following patterns are considered violations:
153
154 ```css
155 /* comment */
156
157 a {}
158 ```
159
160 The following patterns are *not* considered violations:
161
162 ```css
163 /* comment */
164 a {}
165 ```
166
167 #### `"inside-block-and-after-rule"`
168
169 Reverse the primary option if the rule is inside a block and comes after another rule.
170
171 For example, with `"always"`:
172
173 The following patterns are considered violations:
174
175 ```css
176 @media {
177
178   a {}
179
180   b {}
181 }
182 ```
183
184 The following patterns are *not* considered violations:
185
186 ```css
187 @media {
188   a {}
189   b {}
190 }
191 ```
192
193 #### `"inside-block"`
194
195 Reverse the primary option if the rule is inside a block.
196
197 For example, with `"always"`:
198
199 The following patterns are considered violations:
200
201 ```scss
202 a {
203   color: red;
204   
205   b {
206     color: blue;
207   }
208 }
209
210 ```
211
212 The following patterns are *not* considered violations:
213
214 ```scss
215 a {
216   color: red;
217   b {
218     color: blue;
219   }
220 }
221 ```
222
223 #### `"first-nested"`
224
225 Reverse the primary option if the rule is the first in a block.
226
227 For example, with `"always"`:
228
229 The following patterns are considered violations:
230
231 ```css
232 @media {
233
234   a {}
235
236   b {}
237 }
238 ```
239
240 The following patterns are *not* considered violations:
241
242 ```css
243 @media {
244   a {}
245
246   b {}
247 }
248 ```
249
250 ### `ignore: ["after-comment", "inside-block"]`
251
252 #### `"after-comment"`
253
254 Ignore rules that come after a comment.
255
256 For example, with `"always"`:
257
258 The following patterns are *not* considered violations:
259
260 ```css
261 /* comment */
262 a {}
263 ```
264
265 #### `"inside-block"`
266
267 Ignore rules that are inside a block.
268
269 For example, with `"always"`:
270
271 The following patterns are *not* considered violations:
272
273 ```css
274 @media {
275   a {}
276 }
277 ```
278
279 ```css
280 @media {
281   a {}
282   b {}
283 }
284 ```