Skip to content

New Rule: no-unscoped-nesting-selector #553

Open

Description

@sethamus

Rule details

Disallow the nesting selector (&) in a context with no scoping root

What type of rule is this?

Warns about a potential problem

Example code

/* ✗ no enclosing style rule: per css-nesting, `&` here "represents the same
   elements as :scope", so this silently styles the root element */
& {
  color: red;
}

/* ✓ the enclosing style rule is the scoping root */
a {
  & span {
    color: red;
  }
}

Prior Art

https://stylelint.io/user-guide/rules/nesting-selector-no-missing-scoping-root

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

No response

Activity

  1. moved this to Needs Triage in Triageon Sep 1, 2026
  2. moved this from Needs Triage to Feedback Needed in Triageon Sep 1, 2026
  3. DMartens commented on Sep 1, 2026

    @DMartens
    Contributor

    I agree that this would be a helpful rule.
    As this is a rule proposal, we should get more opinions from the team.

  4. added
    acceptedThere is consensus among the team that this change meets the criteria for inclusion
    on Oct 20, 2026
  5. moved this from Feedback Needed to Ready to Implement in Triageon Oct 20, 2026
  6. nzakas commented on Oct 20, 2026

    @nzakas
    Member

    Sounds good to me. 👍

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

Metadata

Metadata

Assignees

Labels

acceptedThere is consensus among the team that this change meets the criteria for inclusionfeature

Type

No type

Projects

  • Status
    Ready to Implement

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions