-
-
Notifications
You must be signed in to change notification settings - Fork 929
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
Trailing comma in selector causes error with no-descending-specificity and Less syntax #1156
Comments
@eddiemoore show example of code and next format issue as template |
The stack trace is a good indication of what's going wrong but we don't know what sourcecode caused it. The function that's throwing is this: function lastCompoundSelectorWithoutPseudo(selectorNode) {
const nodesAfterLastCombinator = _.last(selectorNode.nodes[0].split(node => {
return node.type === "combinator"
}))
const nodesWithoutPseudos = nodesAfterLastCombinator.filter(node => {
return node.type !== "pseudo"
})
return nodesWithoutPseudos.toString()
} So somehow we're ending up with |
When I get into work tomorrow morning I'll see if I can narrow down the files a bit to see if I can pinpoint the piece of LESS code that's causing the problem |
Ok. I have narrowed it down to a single section. .selector,
{
color: red;
} Seems that if there is a comma at the end of the selectors list then it runs into the error. However LESS still compiles the code with no problems. Would have thought the less compiler should point out this issue. |
@eddiemoore it is not valid CSS, @davidtheclark what do you think we should consider it as an additional check? |
@evilebottnawi Yeah I know it's not valid CSS. It's in legacy code, found it strange that the less compiler even compiled it. |
@eddiemoore waiting what say @davidtheclark about this issue |
I think we can try to refactor that function just a little so it is more elegantly handled. Shouldn't be a big deal. |
Close. Merged. Ref: #1181 |
Found a bug when running stylelint against a bunch of less files.
Error with:
no-descending-specificity
Hard to say really what part of the code is causing this issue, as i'm running it agains a HUGE amount of files.
Stylelint configuration:
npm install stylelint-config-migme
Running with version
6.2.2
of stylelintRunning it with CLI with
stylelint app/styles/* --syntax less
I believe it may relate to non-standard styntax because i'm running it against .less files
Expected warnings to be flagged and not causing it to crash.
The following warnings were flagged:
The text was updated successfully, but these errors were encountered: