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 false positives for parametric mixins in selector-class-pattern #5258

Closed
SevenOutman opened this issue Apr 21, 2021 · 5 comments · Fixed by #5378
Closed

Fix false positives for parametric mixins in selector-class-pattern #5258

SevenOutman opened this issue Apr 21, 2021 · 5 comments · Fixed by #5378
Labels
good first issue is good for newcomers status: wip is being worked on by someone syntax: less relates to Less and Less-like syntax type: bug a problem with a feature or rule

Comments

@SevenOutman
Copy link

Clearly describe the bug

Getting selector-class-pattern violations on LESS mixin definitions.

Which rule, if any, is the bug related to?

selector-class-pattern

What code is needed to reproduce the bug?

.my-mixin(@x: 5) {
  line-height: @x;
}

What stylelint configuration is needed to reproduce the bug?

{
  "rules": {
    // kebab-case
    'selector-class-pattern': '^[a-z0-9]+(-?[a-z0-9]+)*$'
  }
}

Which version of stylelint are you using?

13.12.0

How are you running stylelint: CLI, PostCSS plugin, Node.js API?

CLI with stylelint "src/**/*.less" --syntax less"

Does the bug relate to non-standard syntax (e.g. SCSS, Less etc.)?

Yes, it's related to LESS parametric mixins.

What did you expect to happen?

The selector-class-pattern rule ignores LESS mixins as documented

What actually happened (e.g. what warnings or errors did you get)?

Styelint seems not to recognize it as a mixin.

Expected class selector ".my-mixin(@x: 5)" to      selector-class-pattern
match pattern "^[a-z0-9]+(-?[a-z0-9]+)*$"
@jeddy3 jeddy3 changed the title [LESS] false positive for parametric mixins with selector-class-pattern Fix false positives for parametric mixins in selector-class-pattern Apr 21, 2021
@jeddy3 jeddy3 added good first issue is good for newcomers status: ready to implement is ready to be worked on by someone syntax: less relates to Less and Less-like syntax type: bug a problem with a feature or rule labels Apr 21, 2021
@jeddy3
Copy link
Member

jeddy3 commented Apr 21, 2021

@SevenOutman Thanks for the report and clear write-up.

Yes, it appears to be a bug. The heuristics in the isStandardSyntaxRule util need to be tweaked to catch this.

I've labelled 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.

@smile33
Copy link

smile33 commented May 8, 2021

Hope to fix it soon

@jeddy3
Copy link
Member

jeddy3 commented May 8, 2021

@smile33 Please consider contributing if you have time.

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

@jeddy3 jeddy3 added status: wip is being worked on by someone and removed status: ready to implement is ready to be worked on by someone labels Jul 13, 2021
@mattxwang
Copy link
Member

Looks like this should be closed by #5378, but feel free to re-open if needed!

@ybiquitous
Copy link
Member

@mattxwang Good catch! Thank you 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue is good for newcomers status: wip is being worked on by someone syntax: less relates to Less and Less-like syntax type: bug a problem with a feature or rule
Development

Successfully merging a pull request may close this issue.

5 participants