1
0
mirror of https://github.com/thangisme/notes.git synced 2024-11-01 04:27:17 -04:00
notes/node_modules/stylelint/lib/rules/at-rule-empty-line-before/README.md
Patrick Marsceill b7b0d0d7bf
Initial commit
2017-03-09 13:16:08 -05:00

4.9 KiB

at-rule-empty-line-before

Require or disallow an empty line before at-rules.

a {}
          /* ← */
@media {} /* ↑ */
/**          ↑
 *   This line */

If the at-rule is the very first node in a stylesheet then it is ignored.

Options

string: "always"|"never"

"always"

There must always be an empty line before at-rules.

The following patterns are considered warnings:

a {} @media {}
a {}
@media {}

The following patterns are not considered warnings:

a {}

@media {}

"never"

There must never be an empty line before at-rules.

The following patterns are considered warnings:

a {}

@media {}

The following patterns are not considered warnings:

a {} @media {}
a {}
@media {}

Optional secondary options

except: ["after-same-name", "inside-block", "blockless-after-same-name-blockless", "blockless-after-blockless", "first-nested"]

"after-same-name"

Reverse the primary option for at-rules that follow another at-rule with the same name.

This means that you can group your at-rules by name.

For example, with "always":

The following patterns are not considered warnings:

@charset "UTF-8";

@import url(x.css);
@import url(y.css);

@media (min-width: 100px) {}
@media (min-width: 200px) {}
a {

  @extends .foo;
  @extends .bar;

  @include x;
  @include y {}
}

"inside-block"

Note: This option was previously called all-nested.

Reverse the primary option for at-rules that are nested.

For example, with "always":

The following patterns are considered warnings:

a {

  @extend foo;
  color: pink;
}

b {
  color: pink;

  @extend foo;
}

The following patterns are not considered warnings:

a {
  @extend foo;
  color: pink;
}

b {
  color: pink;
  @extend foo;
}

"blockless-after-same-name-blockless"

Reverse the primary option for blockless at-rules that follow another blockless at-rule with the same name.

This means that you can group your blockless at-rules by name.

For example, with "always":

The following patterns are not considered warnings:

@charset "UTF-8";

@import url(x.css);
@import url(y.css);
a {

  @extends .foo;
  @extends .bar;

  @include loop;
  @include doo;
}

"blockless-after-blockless"

Note: This option was previously called blockless-group.

Reverse the primary option for at-rules within a blockless group.

For example, with "always":

The following patterns are considered warnings:

@import url(x.css);

@import url(y.css);

@media print {}

The following patterns are not considered warnings:

@import url(x.css);
@import url(y.css);

@media print {}

"first-nested"

Reverse the primary option for at-rules that are nested and the first child of their parent node.

For example, with "always":

The following patterns are considered warnings:

a {

  @extend foo;
  color: pink;
}

b {
  color: pink;
  @extend foo;
}

The following patterns are not considered warnings:

a {
  @extend foo;
  color: pink;
}

b {
  color: pink;

  @extend foo;
}

ignore: ["after-comment", "inside-block", "blockless-after-same-name-blockless", "blockless-after-blockless"]

"after-comment"

Ignore at-rules that come after a comment.

The following patterns are not considered warnings:

/* comment */
@media {}
/* comment */

@media {}

"inside-block"

Note: This option was previously called all-nested.

Ignore at-rules that are inside a declaration block.

For example, with "always":

The following patterns are not considered warnings:

a {
  @extend foo;
  color: pink;
}

a {

  @extend foo;
  color: pink;
}

b {
  color: pink;
  @extend foo;
}

b {
  color: pink;

  @extend foo;
}

"blockless-after-same-name-blockless"

Ignore blockless at-rules that follow another blockless at-rule with the same name.

This means that you can group your blockless at-rules by name.

For example, with "always":

The following patterns are not considered warnings:


@charset "UTF-8";

@import url(x.css);
@import url(y.css);
a {

  @extends .foo;
  @extends .bar;

  @include loop;
  @include doo;
}

"blockless-after-blockless"

Note: This option was previously called blockless-group.

Ignore blockless at-rules that follow another blockless at-rule.

For example, with "always":

The following patterns are not considered warnings:

@import url(x.css);

@import url(y.css);

@media print {}
@import url(x.css);
@import url(y.css);

@media print {}

ignoreAtRules: ["array", "of", "at-rules"]

Ignore specified at-rules.

For example, with "always".

Given:

["import"]

The following patterns are not considered warnings:

@charset "UTF-8";
@import {}