no-invalid-position-declaration
Disallow invalid position declarations.
color: red;/** ↑ * This declaration */Use this rule to avoid rules that browsers ignore. A declaration outside a block becomes the prelude of the next rule and invalidates it.
Declarations can only be positioned within the <declaration-list>, <declaration-rule-list> and <block-contents> productions.
This rule doesn’t have any message arguments.
Options
Section titled “Options”{ "no-invalid-position-declaration": true}The following patterns are considered problems:
color: red;--foo: red;@media all { color: red;}The following patterns are not considered problems:
a { color: red; }a { --foo: red; }@media all { a { color: red; }}a { @media all { color: red; }}Optional secondary options
Section titled “Optional secondary options”ignoreAtRules
Section titled “ignoreAtRules”{ "ignoreAtRules": ["array", "of", "at-rules", "/regex/"] }Ignore nesting at-rules within specified at-rules.
Given:
{ "no-invalid-position-declaration": [ true, { "ignoreAtRules": ["--foo", "/^--bar-/"] } ]}The following patterns are not considered problems:
@--foo { @media all { color: red; }}@--bar-baz qux { @layer foo { color: red; }}