Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix no-descending-specificity false positives for nested selectors #7724

Conversation

romainmenke
Copy link
Member

Which issue, if any, is this issue related to?

Closes #7723

Is there anything in the PR that needs further explanation?

We didn't have coverage for nested selectors where the nested part is the same while the parent is different.

I should have double checked this when refactoring this rule.

I am certain that this case is very common.
Do we have capacity to ship a patch in the next few days?

Copy link

changeset-bot bot commented May 27, 2024

🦋 Changeset detected

Latest commit: 1f5c69e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
stylelint Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

@Mouvedia Mouvedia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM but could you update line 132 to be

 * @param {import('postcss-selector-parser').Selector} resolvedSelectorNode

?

@Mouvedia
Copy link
Member

Mouvedia commented May 27, 2024

I am certain that this case is very common.
Do we have capacity to ship a patch in the next few days?

We have discussed this with @ybiquitous. He's around thankfully but even if he wasn't you could release in his absence.

@ybiquitous ybiquitous mentioned this pull request May 27, 2024
4 tasks
Copy link
Member

@ybiquitous ybiquitous left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@romainmenke Thanks for the quick patch! LGTM 👍🏼

If you want, I can grant you permission to publish the stylelint package (you don't have it, right?).

I have time to release a new version within a few days, though.

@romainmenke
Copy link
Member Author

It's fine that I don't have publishing access.
Users can stay on 16.5 for now.

Having a next patch out in the next few days is still a really quick response, thank you 🙇

Also thank you for the reviews!

@romainmenke
Copy link
Member Author

This LGTM but could you update line 132 to be
* @param {import('postcss-selector-parser').Selector} resolvedSelectorNode

That function is correct as it is now imho.

This function does transform the provided selector but it is not this transform that was key to this bug. It was which selector was used as the reference.

The transform could be useful for any selector, even those not produced by resolving nested selectors or when the result isn't used as a reference.

@romainmenke romainmenke merged commit 62b58bc into main May 28, 2024
17 checks passed
@romainmenke romainmenke deleted the fix-no-descending-specificity-false-positives-for-nested-selectors--impartial-mouse-f3a12d226e branch May 28, 2024 07:34
davidrapson added a commit to citizensadvice/design-system that referenced this pull request May 28, 2024
Due to a regression in no-descending-specificity rule:
stylelint/stylelint#7724
dependabot bot pushed a commit to citizensadvice/design-system that referenced this pull request May 28, 2024
Due to a regression in no-descending-specificity rule:
stylelint/stylelint#7724
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Fix no-descending-specificity false positives for nested selectors
3 participants