Skip to main content

selector-pseudo-element-allowed-list

Specify a list of allowed pseudo-element selectors.

  a::before {}
/** ↑
* This pseudo-element selector */

This rule ignores:

  • CSS2 pseudo-elements i.e. those prefixed with a single colon
  • selectors that use variable interpolation e.g. ::#{$variable} {}

The message secondary option can accept the arguments of this rule.

Options

Array<string>

["array", "of", "unprefixed", "pseudo-elements", "/regex/"]

Given:

{
"selector-pseudo-element-allowed-list": ["before", "/^--my-/i"]
}

The following patterns are considered problems:

a::after {}
a::--not-my-pseudo-element {}

The following patterns are not considered problems:

a::before {}
a::--my-pseudo-element {}
a::--MY-OTHER-pseudo-element {}