Skip to content

at-extend-no-missing-placeholder

Reports an @extend of anything but a placeholder selector (%name); a selector with interpolation is not reported.

Extending a class or an element rewrites every selector that mentions it, so one @extend can add many selectors to the output and change the cascade of rules that are far from it. A placeholder exists only to be extended, so the effect is local.

To fix, extend a placeholder, or use a mixin.

With this configuration:

no-global-function-names: warn
at-mixin-argumentless-call-parentheses: warn
at-rule-conditional-no-parentheses: warn
at-extend-no-missing-placeholder: warn
at-if-no-null: warn
load-no-partial-leading-underscore: warn
dollar-variable-pattern: { level: warn, options: { pattern: "^[a-z-]+$" } }
at-mixin-pattern: { level: warn, options: { pattern: "^[a-z-]+$" } }
at-function-pattern: { level: warn, options: { pattern: "^[a-z-]+$" } }
Reported
...
a {
...
@include foo() using ($x) { top: 0; }
@extend .b;
@extend %b;
@extend .c-#{$x};
...
css:
lint:
rules:
at-extend-no-missing-placeholder: warn # off (default), warn, error
less:
lint:
rules:
at-extend-no-missing-placeholder: warn # off (default), warn, error
scss:
lint:
rules:
at-extend-no-missing-placeholder: warn # off (default), warn, error

Enabled by the presets: css/stylelint-standard.

Suppress one line with sudsy-disable-next-line at-extend-no-missing-placeholder in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
stylelint-scss scss/at-extend-no-missing-placeholder full