no-invalid-position-at-import-rule
不允许无效的位置 @import
规则。
¥Disallow invalid position @import
rules.
a {}
@import 'foo.css';
/** ↑
* This @import */
任何 @import
规则都必须位于样式表中所有其他有效的 at 规则和样式规则之前(忽略 @charset
和 @layer
),否则 @import
规则无效。
¥Any @import
rules must precede all other valid at-rules and style rules in a stylesheet (ignoring @charset
and @layer
), or else the @import
rule is invalid.
选项
¥Options
true
以下模式被视为问题:
¥The following patterns are considered problems:
a {}
@import 'foo.css';
@media print {}
@import 'foo.css';
以下模式不被视为问题:
¥The following patterns are not considered problems:
@import 'foo.css';
a {}
/* some comment */
@import 'foo.css';
@charset 'utf-8';
@import 'foo.css';
@layer default;
@import url(theme.css) layer(theme);
可选的辅助选项
¥Optional secondary options
ignoreAtRules: ["/regex/", /regex/, "string"]
鉴于:
¥Given:
["/^--my-/", "--custom"]
以下模式不被视为问题:
¥The following patterns are not considered problems:
@--my-at-rule "bar.css";
@import "foo.css";
@--my-other-at-rule {}
@import "foo.css";
@--custom "bar.css";
@import "foo.css"