Stateful CSS

Lint Rules

Every rule in the Stateful CSS Stylelint plugin: what it checks, how severe it is, and whether it can fix.

RuleChecksSeverityFixable
variable-role-prefixEvery custom property you declare, and every `@property` you register, starts with a role prefix and a name.errorno
theme-tokensTokens and theme scopes belong together: a token is declared only in a theme scope, a theme scope declares only tokens and `color-scheme`, and themes are written only in the theme files.errorno
bind-onceEach property is declared once per element. If it needs to change, it's bound once to a state variable, and the variable changes.errorno
bind-through-state-variablesEvery change flows through a variable: a property never reads a private that a variant or a state changes, and a variable a variant writes is never written by a state.errorno
blocking-states-winInteraction states never apply to a blocked element: they sit inside a guard that lists every blocking state, focus stays outside it, and blocking states set only their own look.warningyes
visited-colors-onlyA `:visited` block declares only what `:visited` can apply: its color properties, set directly.errorno
no-undeclared-state-variablesEvery state variable and private an element reads or changes is declared on that element, except what its owner declares for it.errorno
no-unchanged-state-variablesA state variable is changed by a variant, a state or a query.warningno
parts-in-scopeA component's parts are styled only inside its `@scope (root) to ([data-component])`, written after its root block, in the same file.errorno
part-variablesA part variable is written only by the owner of the part it names, and read only by that part.errorno
state-variable-namesA state variable is named after the property that reads it and holds that property's whole value. A part variable is named the same way, after its part.errorno
component-variables-read-onlyA component never writes its own component variables.errorno
no-abbreviationsNames that other people and tools read use full words, not abbreviations.warningno
config-checkThe rules that keep a promise together are switched on together, and no rule the methodology contradicts is on.warningno