container-name-pattern
What it does
Section titled “What it does”Reports a @container name that does not match the pattern option (a regex). An empty pattern allows everything.
Why it matters
Section titled “Why it matters”Container names are global to the page, so a convention keeps them predictable and lowers the risk of two components using one name. The rule is a policy: with no pattern it reports nothing.
Example
Section titled “Example”...@custom-media --good-media (min-width: 1px);...@container badBox (min-width: 1px) { a { color: red } }@container good-box (min-width: 1px) { a { color: red } }...Configuration
Section titled “Configuration”css: lint: rules: container-name-pattern: level: warn # off (default), warn, error options: pattern: ""less: lint: rules: container-name-pattern: level: warn # off (default), warn, error options: pattern: ""scss: lint: rules: container-name-pattern: level: warn # off (default), warn, error options: pattern: ""| Option | Type | Default | Description |
|---|---|---|---|
pattern |
string | "" |
The regex a container name must match. |
Enabled by the presets: css/stylelint-standard.
Suppress one line with sudsy-disable-next-line container-name-pattern 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 | container-name-pattern |
full |