declaration-empty-line-before
要求或禁止声明前有空行。
¥Require or disallow an empty line before declarations.
a {
--foo: pink;
/* ← */
top: 15px; /* ↑ */
} /* ↑ */
/** ↑
* This line */
该规则仅适用于标准属性声明。使用 custom-property-empty-line-before
规则进行自定义属性声明。
¥This rule only applies to standard property declarations. Use the custom-property-empty-line-before
rule for custom property declarations.
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 {
--foo: pink;
top: 5px;
}
a {
bottom: 15px;
top: 5px;
}
以下模式不被视为问题:
¥The following patterns are not considered problems:
a {
--foo: pink;
top: 5px;
}
a {
bottom: 15px;
top: 5px;
}
"never"
以下模式被视为问题:
¥The following patterns are considered problems:
a {
--foo: pink;
bottom: 15px;
}
a {
bottom: 15px;
top: 5px;
}
以下模式不被视为问题:
¥The following patterns are not considered problems:
a {
--foo: pink;
bottom: 15px;
}
a {
bottom: 15px;
top: 5px;
}
可选的辅助选项
¥Optional secondary options
except: ["after-comment", "after-declaration", "first-nested"]
"after-comment"
反转注释后面的声明的主要选项。
¥Reverse the primary option for declarations that follow a comment.
共享行注释不会触发此选项。
¥Shared-line comments do not trigger this option.
例如,对于 "always"
:
¥For example, with "always"
:
以下模式被视为问题:
¥The following patterns are considered problems:
a {
/* comment */
top: 5px;
}
a {
bottom: 5px; /* comment */
top: 5px;
}
以下模式不被视为问题:
¥The following patterns are not considered problems:
a {
/* comment */
top: 5px;
}
a {
bottom: 5px; /* comment */
top: 5px;
}
"after-declaration"
反转另一个声明之后的声明的主要选项。
¥Reverse the primary option for declarations that follow another declaration.
共享行注释不影响此选项。
¥Shared-line comments do not affect this option.
例如,对于 "always"
:
¥For example, with "always"
:
以下模式被视为问题:
¥The following patterns are considered problems:
a {
bottom: 15px;
top: 5px;
}
a {
bottom: 15px; /* comment */
top: 5px;
}
以下模式不被视为问题:
¥The following patterns are not considered problems:
a {
bottom: 15px;
top: 5px;
}
a {
bottom: 15px; /* comment */
top: 5px;
}
"first-nested"
反转嵌套声明及其父节点的第一个子节点的主要选项。
¥Reverse the primary option for declarations that are nested and the first child of their parent node.
例如,对于 "always"
:
¥For example, with "always"
:
以下模式被视为问题:
¥The following patterns are considered problems:
a {
bottom: 15px;
top: 5px;
}
以下模式不被视为问题:
¥The following patterns are not considered problems:
a {
bottom: 15px;
top: 5px;
}
ignore: ["after-comment", "after-declaration", "first-nested", "inside-single-line-block"]
"after-comment"
忽略注释后面的声明。
¥Ignore declarations that follow a comment.
例如,对于 "always"
:
¥For example, with "always"
:
以下模式不被视为问题:
¥The following patterns are not considered problems:
a {
/* comment */
bottom: 15px;
}
"after-declaration"
忽略另一个声明后面的声明。
¥Ignore declarations that follow another declaration.
例如,对于 "always"
:
¥For example, with "always"
:
以下模式不被视为问题:
¥The following patterns are not considered problems:
a {
bottom: 15px;
top: 15px;
}
a {
bottom: 15px;
top: 15px;
}
a {
color: orange;
text-decoration: none;
bottom: 15px;
top: 15px;
}
"first-nested"
忽略嵌套的声明及其父节点的第一个子节点。
¥Ignore declarations that are nested and the first child of their parent node.
例如,对于 "always"
:
¥For example, with "always"
:
以下模式不被视为问题:
¥The following patterns are not considered problems:
a {
bottom: 15px;
top: 5px;
}
"inside-single-line-block"
忽略单行块内的声明。
¥Ignore declarations that are inside single-line blocks.
例如,对于 "always"
:
¥For example, with "always"
:
以下模式不被视为问题:
¥The following patterns are not considered problems:
a { bottom: 15px; top: 5px; }