selector-class-pattern
What it does
Section titled “What it does”Reports a class selector whose name does not match the pattern option (a regex). An empty pattern allows everything.
Why it matters
Section titled “Why it matters”A naming convention for classes (kebab case, BEM) makes them predictable, so you can guess a class and search for it. The rule is a policy: with no pattern it reports nothing.
Example
Section titled “Example”.good-name, .badName, #bad_id, #good-id { --good-name: 1; --badName: 2 }...@keyframes good-frames { from { top: 0 } }...@container good-box (min-width: 1px) { a { color: red } }A, B.c:not(.dX) {}Configuration
Section titled “Configuration”css: lint: rules: selector-class-pattern: level: warn # off (default), warn, error options: pattern: ""less: lint: rules: selector-class-pattern: level: warn # off (default), warn, error options: pattern: ""scss: lint: rules: selector-class-pattern: level: warn # off (default), warn, error options: pattern: ""| Option | Type | Default | Description |
|---|---|---|---|
pattern |
string | "" |
The regex a class name must match. |
Enabled by the presets: css/stylelint-standard.
Suppress one line with sudsy-disable-next-line selector-class-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 | selector-class-pattern |
full |