Skip to content

noInvalidPositionAtImportRule

¥Summary

¥How to configure

biome.json
{
"linter": {
"rules": {
"correctness": {
"noInvalidPositionAtImportRule": "error"
}
}
}
}

¥Description

禁止在无效位置使用 @import at-rules。

¥Disallow the use of @import at-rules in invalid positions.

任何 @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.

¥Examples

¥Invalid

a {}
@import 'foo.css';
code-block.css:2:2 lint/correctness/noInvalidPositionAtImportRule ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

This @import is in the wrong position.

1 │ a {}
> 2 │ @import ‘foo.css’;
^^^^^^^^^^^^^^^^^
3 │

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.

Consider moving import position.

¥Valid

@import 'foo.css';
a {}

¥Related links