Skip to main content

selector-no-deprecated

Disallow deprecated selectors.

nobr {}
/** ↑
* This selector */

This rule flags selectors that were removed or deprecated after being in the CSS specifications, including Editor Drafts, and were either:

  • shipped in a release browser version
  • shipped in a pre-release browser version
  • shipped but behind feature flags
  • polyfilled with some adoption before any browser shipped
  • given an MDN page

The fix option can automatically fix some of the problems reported by this rule.

Options

true

{
"selector-no-deprecated": true
}

The following patterns are considered problems:

acronym {}
a:focus-ring {}
.foo::shadow a {}

The following patterns are not considered problems:

abbr {}
a:focus-visible {}

Optional secondary options

ignoreSelectors

{ "ignoreSelectors": ["array", "of", "selectors", "/regex/"] }

Given:

{
"selector-no-deprecated": [true, { "ignoreSelectors": ["contains", "/ern/"] }]
}

The following patterns are not considered problems:

:contains(a) {}
svg hkern, vkern {}