Skip to content

Cannot parse selector warning for mixins with 2 or more parameters in selector-max-specificity #2677

Closed
@PhilippeProulx

Description

Describe the issue. Is it a bug or a feature request (new rule, new option, etc.)?

A bug where using the less & operator with nested classes within a mixin that has more than one parameter causes a parsing error.

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

It seems to be related to selector-max-specificity since the error will not show up when this rule is not used in the config file.

What CSS is needed to reproduce this issue?

.foo {
  .myMixin(@a, @b) {
    &.bar {
      color: pink;
    }
  }
}

Note: The error does not occur when one parameter or less is used in the mixin.

What stylelint configuration is needed to reproduce this issue?

{
  "extends": "stylelint-config-standard",
  "rules": {
    "selector-max-specificity": "0,4,0"
  }
}

Which version of stylelint are you using?

7.11.1

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

CLI with stylelint foo.less

Does your issue relate to non-standard syntax (e.g. SCSS, nesting, etc.)?

Yes, it's related to LESS nested class with & operator in a mixin.

What did you expect to happen?

no parsing error

What actually happened (e.g. what warnings or errors you are getting)?

The following error was outputted:

3:5     Cannot parse selector

Metadata

Assignees

No one assigned

    Labels

    status: wipis being worked on by someonesyntax: lessrelates to Less and Less-like syntax

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions