1 # at-rule-empty-line-before
3 Require or disallow an empty line before at-rules.
13 If the at-rule is the very first node in a stylesheet then it is ignored. `@import` in Less will also be ignored.
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.
19 `string`: `"always"|"never"`
23 There *must always* be an empty line before at-rules.
25 The following patterns are considered violations:
36 The following patterns are *not* considered violations:
46 There *must never* be an empty line before at-rules.
48 The following patterns are considered violations:
56 The following patterns are *not* considered violations:
67 ## Optional secondary options
69 ### `except: ["after-same-name", "inside-block", "blockless-after-same-name-blockless", "blockless-after-blockless", "first-nested"]`
71 #### `"after-same-name"`
73 Reverse the primary option for at-rules that follow another at-rule with the same name.
75 This means that you can group your at-rules by name.
77 For example, with `"always"`:
79 The following patterns are *not* considered violations:
87 @media (min-width: 100px) {}
88 @media (min-width: 200px) {}
102 #### `"inside-block"`
104 Reverse the primary option for at-rules that are nested.
106 For example, with `"always"`:
108 The following patterns are considered violations:
124 The following patterns are *not* considered violations:
138 #### `"blockless-after-same-name-blockless"`
140 Reverse the primary option for blockless at-rules that follow another blockless at-rule with the same name.
142 This means that you can group your blockless at-rules by name.
144 Shared-line comments do not affect this option.
146 For example, with `"always"`:
148 The following patterns are *not* considered violations:
160 @import url(x.css); /* comment */
175 #### `"blockless-after-blockless"`
177 Reverse the primary option for at-rules within a blockless group.
179 Shared-line comments do not affect this option.
181 For example, with `"always"`:
183 The following patterns are considered violations:
193 The following patterns are *not* considered violations:
203 @import url(x.css); /* comment */
209 #### `"first-nested"`
211 Reverse the primary option for at-rules that are nested and the first child of their parent node.
213 For example, with `"always"`:
215 The following patterns are considered violations:
230 The following patterns are *not* considered violations:
245 ### `ignore: ["after-comment", "inside-block", "blockless-after-same-name-blockless", "blockless-after-blockless"]`
247 #### `"after-comment"`
249 Ignore at-rules that come after a comment.
251 Shared-line comments do not trigger this option.
253 The following patterns are *not* considered violations:
267 @media {} /* comment */
272 #### `"inside-block"`
274 Ignore at-rules that are inside a declaration block.
276 For example, with `"always"`:
278 The following patterns are *not* considered violations:
304 #### `"blockless-after-same-name-blockless"`
306 Ignore blockless at-rules that follow another blockless at-rule with the same name.
308 This means that you can group your blockless at-rules by name.
310 For example, with `"always"`:
312 The following patterns are *not* considered violations:
333 #### `"blockless-after-blockless"`
335 Ignore blockless at-rules that follow another blockless at-rule.
337 For example, with `"always"`:
339 The following patterns are *not* considered violations:
356 ### `ignoreAtRules: ["array", "of", "at-rules"]`
358 Ignore specified at-rules.
360 For example, with `"always"`.
368 The following patterns are *not* considered violations: