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
"always"
{
"custom-property-empty-line-before": "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"
{
"custom-property-empty-line-before": "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
{ "except": ["array", "of", "options"] }
"after-comment"
反转注释后面的自定义属性的主要选项。
¥Reverse the primary option for custom properties that follow a comment.
共享行注释不会触发此选项。
¥Shared-line comments do not trigger this option.
鉴于:
¥Given:
{
"custom-property-empty-line-before": [
"always",
{ "except": ["after-comment"] }
]
}
以下模式被视为问题:
¥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.
鉴于:
¥Given:
{
"custom-property-empty-line-before": [
"always",
{ "except": ["after-custom-property"] }
]
}
以下模式被视为问题:
¥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.
鉴于:
¥Given:
{
"custom-property-empty-line-before": [
"always",
{ "except": ["first-nested"] }
]
}
以下模式被视为问题:
¥The following patterns are considered problems:
a {
--foo: pink;
--bar: red;
}
以下模式不被视为问题:
¥The following patterns are not considered problems:
a {
--foo: pink;
--bar: red;
}
ignore
{ "ignore": ["array", "of", "options"] }
"after-comment"
忽略注释后面的自定义属性。
¥Ignore custom properties that follow a comment.
鉴于:
¥Given:
{
"custom-property-empty-line-before": [
"always",
{ "except": ["after-comment"] }
]
}
以下模式不被视为问题:
¥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.
鉴于:
¥Given:
{
"custom-property-empty-line-before": [
"always",
{ "except": ["first-nested"] }
]
}
以下模式不被视为问题:
¥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.
鉴于:
¥Given:
{
"custom-property-empty-line-before": [
"always",
{ "except": ["inside-single-line-block"] }
]
}
以下模式不被视为问题:
¥The following patterns are not considered problems:
a { --foo: pink; --bar: red; }