Skip to content

noInvalidPositionAtImportRule (CSS)

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

Disallow @import after other rules.

An @import must appear before style rules and most at-rules. Only @charset and @layer may appear before it. Browsers ignore an @import placed later in the stylesheet.

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 {}