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