no-invalid-position-at-import-rule
CSS / SCSS / LessCSS / SCSS / LessCSS / SCSS / Lesscorrectnessno fixdefault: warncss/stylelint-recommended
What it does
Section titled “What it does”Reports an @import that comes after a rule that is not @charset, @layer or another @import.
Why it matters
Section titled “Why it matters”CSS ignores an @import that is not at the top of the stylesheet, so the file it names is never loaded and the styles silently are missing. There is no error in the browser.
To fix, move the @import above every rule, behind @charset and @layer.
Example
Section titled “Example”.a { color: red }@import "a";Configuration
Section titled “Configuration”css: lint: rules: no-invalid-position-at-import-rule: warn # off, warn (default), errorless: lint: rules: no-invalid-position-at-import-rule: warn # off, warn (default), errorscss: lint: rules: no-invalid-position-at-import-rule: warn # off, warn (default), errorEnabled by the presets: css/stylelint-recommended.
Suppress one line with sudsy-disable-next-line no-invalid-position-at-import-rule in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| stylelint | no-invalid-position-at-import-rule |
full |