跳转到内容

noInvalidPositionAtImportRule

Diagnostic Category: lint/correctness/noInvalidPositionAtImportRule

Since: v1.8.0

Sources:

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

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.

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.

@import 'foo.css';
a {}