Skip to main content

selector-pseudo-class-disallowed-list

Specify a list of disallowed pseudo-class selectors.

  a:hover {}
/** ↑
* This pseudo-class selector */

This rule ignores selectors that use variable interpolation e.g. :#{$variable} {}.

Options

array|string|regex: ["array", "of", "unprefixed", /pseudo-classes/, "/regex/"]|"pseudo-class"|"/regex/"|/regex/

If a string is surrounded with "/" (e.g. "/^nth-/"), it is interpreted as a regular expression. This allows, for example, easy targeting of shorthands: /^nth-/ will match nth-child, nth-last-child, nth-of-type, etc.

Given:

["hover", "/^nth-/"]

The following patterns are considered problems:

a:hover {}
a:nth-of-type(5) {}
a:nth-child(2) {}

The following patterns are not considered problems:

a:focus {}
a:first-of-type {}