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-duplicate-selectors false negatives for three or more duplicates #7583

Open
erosman opened this issue Mar 27, 2024 · 8 comments
Open
Labels
status: ask to implement ask before implementing as may no longer be relevant type: bug a problem with a feature or rule

Comments

@erosman
Copy link

erosman commented Mar 27, 2024

What minimal example or steps are needed to reproduce the bug?

a[href*="abc"],
a[href*=""],
a[href*=""],
a[href*=""] {
  color: #fd0;
}

What minimal configuration is needed to reproduce the bug?

default

How did you run Stylelint?

Demo

Which Stylelint-related dependencies are you using?

{
  "stylelint": "16.3.0",
  "stylelint-config-standard": "36.0.0"
}

What did you expect to happen?

Error should occur on line 3 & 4 and refer to line 2 e.g.
Line 2 selector is not a duplicate of line 1 selector.


PS. (on another note) Is there a rule for empty selector value? 🤔

What actually happened?

ERROR Unexpected duplicate selector "a[href*=""]", first used at line 1 (no-duplicate-selectors) [2:1-12]

Do you have a proposal to fix the bug?

No response

@ybiquitous ybiquitous added status: ready to implement is ready to be worked on by someone type: bug a problem with a feature or rule labels Mar 28, 2024
@ybiquitous
Copy link
Member

@erosman Thanks for the report. As you commented, this is a bug.

I've labeled the issue as ready to implement. Please consider contributing if you have time.

There are steps on how to fix a bug in a rule in the Developer guide.

@ybiquitous
Copy link
Member

PS. (on another note) Is there a rule for empty selector value? 🤔

Sadly, we have no such a rule in the built-in rules. If you're interested, feel free to open a new issue.

@ybiquitous ybiquitous changed the title no-duplicate-selectors issue with empty values Fix no-duplicate-selectors false negatives for empty attribute values Mar 28, 2024
@ybiquitous
Copy link
Member

For your reference, this bug is not only for empty values.

a[href*="abc"], /* this line only is reported */
a[href*="abc"],
a[href*="abc"],
a[href*=""] {
  color: #fd0;
}

See the demo.

@ybiquitous ybiquitous changed the title Fix no-duplicate-selectors false negatives for empty attribute values Fix no-duplicate-selectors false negatives for three or more duplicates Mar 28, 2024
@erosman
Copy link
Author

erosman commented Mar 28, 2024

@erosman Thanks for the report. As you commented, this is a bug.

I've labeled the issue as ready to implement. Please consider contributing if you have time.

There are steps on how to fix a bug in a rule in the Developer guide.

Is the code for the rule in /lib/rules/no-duplicate-selectors/index.mjs?

TBH, my writing style is considerably different for me to contribute to the code.

@ybiquitous
Copy link
Member

Is the code for the rule in /lib/rules/no-duplicate-selectors/index.mjs?

Yes.

TBH, my writing style is considerably different for me to contribute to the code.

Regarding coding style, we keep consistency thanks to Prettier and ESLint.

@erosman
Copy link
Author

erosman commented Mar 31, 2024

BTW, is CLA required by StyleLint?
(It prevented me from processing a PR in ESLint.)

@ybiquitous
Copy link
Member

ybiquitous commented Mar 31, 2024

No, CLA is not required.

Copy link
Contributor

github-actions bot commented May 1, 2024

This issue is older than one month. Please ask before opening a pull request, as it may no longer be relevant.

@github-actions github-actions bot added status: ask to implement ask before implementing as may no longer be relevant and removed status: ready to implement is ready to be worked on by someone labels May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ask to implement ask before implementing as may no longer be relevant type: bug a problem with a feature or rule
Development

No branches or pull requests

2 participants