Fix no-duplicate-selectors false positives with Less syntax#7888
Merged
ybiquitous merged 4 commits intomainfrom Jul 30, 2024
Merged
Conversation
🦋 Changeset detectedLatest commit: 51b267c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Mouvedia
reviewed
Jul 29, 2024
Mouvedia
reviewed
Jul 29, 2024
…009' of https://github.com/stylelint/stylelint into fix-no-duplicate-selectors--reliable-wildebeest-a99e43d009
Mouvedia
approved these changes
Jul 29, 2024
| description: 'Non standard Less nested interpolation (3', | ||
| }, | ||
| { | ||
| code: '.foo() { .bar > & { color: #000; } &.readonly { color: #fff; } }', |
Member
There was a problem hiding this comment.
I suppose the mixin is being ignored in its entirety.
i.e. if there are duplicates in .foo() { /* here */ }, they won't be detected
Member
|
@ybiquitous Should we release 16.8.1 ? |
ybiquitous
approved these changes
Jul 30, 2024
Member
ybiquitous
left a comment
There was a problem hiding this comment.
Thanks, LGTM 👍🏼
I'll release 16.8.1 soon.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #7887
flattenNestedSelectorsForRulecan return an empty list on invalid syntax.This forgiving behavior is intended as it also allows us to lint partially standard selector lists.
However in
no-duplicate-selectorswe also use these lists (after normalizing) to detect duplicates. And when the entire list is non-standard the resulting selector will be an empty string.Each empty string is equal to any other empty string, so in turn each non-standard selector list is considered a duplicate of every other non-standard selector list.
Adding a check that
flattenNestedSelectorsForRuledid return at least one selector resolves any issues with non-standard syntaxes.