Skip to content

at-rule-name-newline-after ​

Require a newline after at-rule names.

css
    @media
   /*↑*/  (max-width: 600px) {}
/**  ↑
 * The newline after this at-rule name */

The fix option can automatically fix most of the problems reported by this rule. Under Less it writes no break behind an @import or @plugin with no whitespace behind the name, since Less takes the two as directives only with whitespace there. The warning stands.

The rule passes over @charset, whose spelling Stylelint's at-charset-rule-no-invalid rule judges; a CSS file holding one gets a warning asking for that rule where the configuration leaves it off.

Options ​

string: "always"|"always-multi-line"

"always" ​

There must always be a newline after at-rule names.

The following patterns are considered problems:

css
@import "x.css";
css
@media (min-width: 700px) and
  (orientation: landscape) {}

The following patterns are not considered problems:

css
@import
  "x.css";
css
@import
  "x.css" screen and
 (orientation:landscape);
css
@media
  (min-width: 700px) and (orientation: landscape) {}
css
@media
  (min-width: 700px) and
  (orientation: landscape) {}

"always-multi-line" ​

There must always be a newline after at-rule names in at-rules with multi-line parameters.

The following patterns are considered problems:

css
@import "x.css" screen and
 (orientation:landscape);
css
@media (min-width: 700px) and
 (orientation: landscape) {}

The following patterns are not considered problems:

css
@import "x.css";
css
@import
  "x.css";
css
@import "x.css" screen and (orientation:landscape);
css
@media (min-width: 700px) and (orientation: landscape) {}
css
@media
  (min-width: 700px) and
  (orientation: landscape) {}

Released under the MIT License.