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

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

Closed
PhilippeProulx opened this Issue Jun 26, 2017 · 5 comments

Comments

4 participants
@PhilippeProulx

PhilippeProulx commented Jun 26, 2017

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
@hudochenkov

This comment has been minimized.

Member

hudochenkov commented Jun 26, 2017

Please, use issue template, and provide your config.

@PhilippeProulx

This comment has been minimized.

PhilippeProulx commented Jun 26, 2017

Thanks for the quick reply, I updated my issue to comply with the template and added more information.

@jeddy3

This comment has been minimized.

Member

jeddy3 commented Jun 26, 2017

Can we add a heuristic to isStandardSyntaxSelector that ignores something like .myMixin(@a, @b).bar?

@PhilippeProulx Non-standard syntax support isn't a priority for the core team. Please consider contributing a fix if you'd like to see this issue resolved.

@jeddy3 jeddy3 changed the title from Less: nested class with & causes a parsing error to Cannot parse selector warning for mixins with 2 or more parameters in selector-max-specificity Jun 26, 2017

@jwilsson

This comment has been minimized.

Member

jwilsson commented Jul 17, 2017

I'll take a look at this one.

@jeddy3

This comment has been minimized.

Member

jeddy3 commented Jul 17, 2017

Done in #2755

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment