-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Description
Problem
Snippet: https://github.com/csstree/stylelint-validator/blob/v2.0.0/lib/syntax-extension/sass/index.js
is causing the error
At-rule '@else' should contain a prelude (csstree/validator)
with code
@if ($value == 0) {
@return 0;
} @else if ($value == 1) {
@return 10;
} @else {
@return $delta;
}
}Analysis
As the else scss at-rule, doesn`t have a prelude, it looked like the simple solution would be:
// /lib/syntax-extension/sass/index.js#L56
syntaxConfig.atrules.else = {
prelude: null
};// /test/preprocessors.js#L80
// Add braces to ensure xxx is or is not seen as prelude
tr.ok('@else {}');
// Add missing else if
tr.ok('@else if {}');But then the tr.ok('@else if {}'); assertion fails with At-rule '@else' should not contain a prelude (csstree/validator).
If we analyse the AST of the first code snippet (available here), the else if at-rule takes everything starting from if as prelude.
What should be the correct configuration for the else and else-if at-rule?
I've already forked the repo and tinkered with, without any success. Can you be of further assistance?
sobolevn and arnassavickas
Metadata
Metadata
Assignees
Labels
No labels