Skip to content

Files

Latest commit

 

History

History
231 lines (152 loc) · 2.86 KB

custom-property-empty-line-before.md

File metadata and controls

231 lines (152 loc) · 2.86 KB

Pattern: Malformed empty line before custom property

Issue: -

Description

Require or disallow an empty line before custom properties.

Examples

"always"

The following patterns are considered violations:

a {
  top: 10px;
  --foo: pink;
  --bar: red;
}

The following patterns are not considered violations:

a {
  top: 10px;

  --foo: pink;

  --bar: red;
}

"never"

The following patterns are considered violations:

a {
  top: 10px;

  --foo: pink;

  --bar: red;
}
a {

  --foo: pink;
  --bar: red;
}

The following patterns are not considered violations:

a {
  top: 10px;
  --foo: pink;
  --bar: red;
}
a {
  --foo: pink;
  --bar: red;
}

Configuration

except: ["after-comment", "after-custom-property", "first-nested"]

"after-comment"

Reverse the primary option for custom properties that come after a comment.

Shared-line comments do not trigger this option.

For example, with "always":

The following patterns are considered violations:

a {

  --foo: pink;
  /* comment */

  --bar: red;
}
a {

  --foo: pink; /* comment */
  --bar: red;
}

The following patterns are not considered violations:

a {

  --foo: pink;
  /* comment */
  --bar: red;
}
a {

  --foo: pink; /* comment */

  --bar: red;
}

"after-custom-property"

Reverse the primary option for custom properties that come after another custom property.

Shared-line comments do not affect this option.

For example, with "always":

The following patterns are considered violations:

a {

  --foo: pink;

  --bar: red;
}
a {

  --foo: pink; /* comment */

  --bar: red;
}

The following patterns are not considered violations:

a {

  --foo: pink;
  --bar: red;
}
a {

  --foo: pink; /* comment */
  --bar: red;
}

"first-nested"

Reverse the primary option for custom properties that are nested and the first child of their parent node.

For example, with "always":

The following patterns are considered violations:

a {

  --foo: pink;

  --bar: red;
}

The following patterns are not considered violations:

a {
  --foo: pink;

  --bar: red;
}

ignore: ["after-comment", "inside-single-line-block"]

"after-comment"

Ignore custom properties that are preceded by comments.

For example, with "always":

The following patterns are not considered violations:

a {
  /* comment */
  --foo: pink;
}

"inside-single-line-block"

Ignore custom properties that are inside single-line blocks.

For example, with "always":

The following patterns are not considered violations:

a { --foo: pink; --bar: red; }

Further Reading