Skip to content

New Rule: no-invalid-pseudo-selectors #551

Description

@BHyeonKim

Rule details

Warns when a selector uses a pseudo-class or pseudo-element name that doesn't exist in the CSS specifications (e.g. a typo like :hoverr or ::befor) — an unknown pseudo-class/element causes the entire selector (and rule) to be silently dropped by browsers.

What type of rule is this?

Warns about a potential problem

Example code

/* WARNING: 'hoverr' and 'befor' are typos, not real pseudo-classes/pseudo-elements */
a:hoverr {
  color: red;
}

p::befor {
  content: "";
}

/* OK */
a:hover {
  color: red;
}

p::before {
  content: "";
}

Prior Art

stylelint covers this with two separate rules:

Participation

  • I am willing to submit a pull request to implement this rule.

AI acknowledgment

  • I did not use AI to generate this issue report.
  • (If the above is not checked) I have reviewed the AI-generated content before submitting.

Additional comments

Disclosure: I'm a participant of open source contribution program OSSCA

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

  • Status
    Needs Triage

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions