no-invalid-position-declaration
CSS / SCSS / LessCSS / SCSS / LessCSS / SCSS / Lesscorrectnessno fixdefault: warncss/stylelint-recommended
What it does
Section titled “What it does”Reports a declaration at the top of a file, or in an at-rule such as @media that is not inside a rule.
Why it matters
Section titled “Why it matters”CSS has declarations only inside a rule. At the top of a file the declaration is a syntax error and the browser skips it and the text up to the next } or ;, which may take the next rule with it.
To fix, put the declaration in a rule.
Example
Section titled “Example”...}@media (a) { top: 0; }@media (b) { top: 0; }... --b: 2;...Configuration
Section titled “Configuration”css: lint: rules: no-invalid-position-declaration: warn # off, warn (default), errorless: lint: rules: no-invalid-position-declaration: warn # off, warn (default), errorscss: lint: rules: no-invalid-position-declaration: warn # off, warn (default), errorEnabled by the presets: css/stylelint-recommended.
Suppress one line with sudsy-disable-next-line no-invalid-position-declaration 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-declaration |
full |