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 TypeError with @nest in combination with pseudo-classes with multiple arguments in selector-max-compound-selectors #2453

Open
woble opened this issue Mar 29, 2017 · 5 comments
Labels
status: ask to implement ask before implementing as may no longer be relevant type: bug a problem with a feature or rule upstream relates to an upstream package

Comments

@woble
Copy link

woble commented Mar 29, 2017

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

Complex nesting via use of @nest (postcss-nesting) in combination with :not() and/or :matches() with multiple arguments produces an error.

Split from #2269

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

Seems to be related to selector-max-compound-selectors.

What CSS is needed to reproduce this issue?

.de {
    @nest
    .cd:not(:hover, :focus) & {
        & .fg {
            color: red;
        }
    }
}

What stylelint configuration is needed to reproduce this issue?

{
  "rules":
  {
    "selector-max-compound-selectors": 3
  }
}

Which version of stylelint are you using?

7.9.0

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

CLI

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

  • Use of @nest via postcss-nesting.
  • Multiple arguments in :not().

What did you expect to happen?

No warnings to be flagged.

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

Error: Expected closing parenthesis.
    at new error (C:\Users\user\AppData\Roaming\npm\node_modules\stylelint\node_modules\postcss-selector-parser\dist\processor.js:29:23)
    at Parser.error (C:\Users\user\AppData\Roaming\npm\node_modules\stylelint\node_modules\postcss-selector-parser\dist\parser.js:234:15)
    at Parser.parentheses (C:\Users\user\AppData\Roaming\npm\node_modules\stylelint\node_modules\postcss-selector-parser\dist\parser.js:303:22)
    at Parser.parse (C:\Users\user\AppData\Roaming\npm\node_modules\stylelint\node_modules\postcss-selector-parser\dist\parser.js:533:22)
    at Parser.loop (C:\Users\user\AppData\Roaming\npm\node_modules\stylelint\node_modules\postcss-selector-parser\dist\parser.js:519:18)
    at new Parser (C:\Users\user\AppData\Roaming\npm\node_modules\stylelint\node_modules\postcss-selector-parser\dist\parser.js:104:21)
    at Processor.process (C:\Users\user\AppData\Roaming\npm\node_modules\stylelint\node_modules\postcss-selector-parser\dist\processor.js:26:21)
    at resolvedNestedSelector.forEach.resolvedSelector (C:\Users\user\AppData\Roaming\npm\node_modules\stylelint\lib\rules\selector-max-compound-selectors\index.js:76:55)
    at Array.forEach (native)
    at rule.selectors.forEach.selector (C:\Users\user\AppData\Roaming\npm\node_modules\stylelint\lib\rules\selector-max-compound-selectors\index.js:74:48)
@jeddy3
Copy link
Member

jeddy3 commented Mar 29, 2017

@woble Thanks for creating a new issue! Much easier to digest.

It looks to be a bug. I tried postcss-selector-parser with .de .cd:not(:hover, :focus) .fg and it seemed to have no problem with it. So, it does indeed look to be a problem with the combination of @nest.

Labelling as help wanted and bug.

@jeddy3 jeddy3 added status: ready to implement is ready to be worked on by someone type: bug a problem with a feature or rule labels Mar 29, 2017
@jeddy3 jeddy3 changed the title Nesting via @nest in comination with pseudo-classes with multiple arguments Error with @nest in combination with pseudo-classes with multiple arguments in selector-max-compound-selectors Mar 29, 2017
@hudochenkov
Copy link
Member

Problem with postcss-resolve-nested-selector. It resolves selector as [".de .cd:not(:hover .fg", ":focus) .de .fg"].

To be fair, :not only supports simple selectors by CSS3 specification. In working draft of CSS4 it supports complex selectors.

Selectors Level 3
Selectors Level 4

@woble
Copy link
Author

woble commented Mar 29, 2017

Perhaps @davidtheclark can be of some help.

@alexander-akait
Copy link
Member

Seems bug in postcss-resolve-nested-selector

@alexander-akait alexander-akait added the status: blocked is blocked by another issue or pr label Aug 14, 2017
@jeddy3 jeddy3 changed the title Error with @nest in combination with pseudo-classes with multiple arguments in selector-max-compound-selectors Error with @nest in combination with pseudo-classes with multiple arguments in selector-max-compound-selectors Mar 15, 2018
@jeddy3 jeddy3 added upstream relates to an upstream package and removed status: blocked is blocked by another issue or pr labels May 19, 2021
@jeddy3 jeddy3 changed the title Error with @nest in combination with pseudo-classes with multiple arguments in selector-max-compound-selectors Fix TypeError with @nest in combination with pseudo-classes with multiple arguments in selector-max-compound-selectors May 19, 2021
Copy link
Contributor

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 Jan 22, 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 upstream relates to an upstream package
Development

No branches or pull requests

4 participants