Skip to main content

custom-property-empty-line-before

要求或禁止自定义属性前有空行。

¥Require or disallow an empty line before custom properties.

a {
top: 10px;
/* ← */
--foo: pink; /* ↑ */
} /* ↑ */
/** ↑

* This line */

fix 选项 可以自动修复此规则报告的所有问题。

¥The fix option can automatically fix all of the problems reported by this rule.

选项

¥Options

string"always"|"never"

"always"

以下模式被视为问题:

¥The following patterns are considered problems:

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

以下模式不被视为问题:

¥The following patterns are not considered problems:

a {
top: 10px;

--foo: pink;

--bar: red;
}

"never"

以下模式被视为问题:

¥The following patterns are considered problems:

a {
top: 10px;

--foo: pink;

--bar: red;
}
a {

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

以下模式不被视为问题:

¥The following patterns are not considered problems:

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

可选的辅助选项

¥Optional secondary options

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

"after-comment"

反转注释后面的自定义属性的主要选项。

¥Reverse the primary option for custom properties that follow a comment.

共享行注释不会触发此选项。

¥Shared-line comments do not trigger this option.

例如,对于 "always"

¥For example, with "always":

以下模式被视为问题:

¥The following patterns are considered problems:

a {

--foo: pink;
/* comment */

--bar: red;
}
a {

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

以下模式不被视为问题:

¥The following patterns are not considered problems:

a {

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

--foo: pink; /* comment */

--bar: red;
}

"after-custom-property"

反转另一个自定义属性后面的自定义属性的主要选项。

¥Reverse the primary option for custom properties that follow another custom property.

共享行注释不影响此选项。

¥Shared-line comments do not affect this option.

例如,对于 "always"

¥For example, with "always":

以下模式被视为问题:

¥The following patterns are considered problems:

a {

--foo: pink;

--bar: red;
}
a {

--foo: pink; /* comment */

--bar: red;
}

以下模式不被视为问题:

¥The following patterns are not considered problems:

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.

例如,对于 "always"

¥For example, with "always":

以下模式被视为问题:

¥The following patterns are considered problems:

a {

--foo: pink;

--bar: red;
}

以下模式不被视为问题:

¥The following patterns are not considered problems:

a {
--foo: pink;

--bar: red;
}

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

"after-comment"

忽略注释后面的自定义属性。

¥Ignore custom properties that follow a comment.

例如,对于 "always"

¥For example, with "always":

以下模式不被视为问题:

¥The following patterns are not considered problems:

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

"first-nested"

忽略嵌套的自定义属性及其父节点的第一个子节点。

¥Ignore custom properties that are nested and the first child of their parent node.

例如,对于 "always"

¥For example, with "always":

以下模式不被视为问题:

¥The following patterns are not considered problems:

a {
--foo: pink;

--bar: red;
}

"inside-single-line-block"

忽略单行块内的自定义属性。

¥Ignore custom properties that are inside single-line blocks.

例如,对于 "always"

¥For example, with "always":

以下模式不被视为问题:

¥The following patterns are not considered problems:

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