-
Notifications
You must be signed in to change notification settings - Fork 458
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
Scoped variables cause an error when sort-order is enabled #443
Comments
For me this isn't fixed. Still get this issue when I use variables or at-rules. :/ |
Windows 10, vscode insider build and stable build config: {
"always-semicolon": true,
"color-case": "lower",
"block-indent": "\t",
"color-shorthand": false,
"element-case": "lower",
"eof-newline": true,
"leading-zero": true,
"quotes": "double",
"sort-order-fallback": "abc",
"space-before-colon": "",
"space-after-colon": " ",
"space-before-combinator": " ",
"space-after-combinator": " ",
"space-between-declarations": "\n",
"space-before-opening-brace": " ",
"space-after-opening-brace": "\n",
"space-after-selector-delimiter": "\n",
"space-before-selector-delimiter": "",
"space-before-closing-brace": "\n",
"strip-spaces": true,
"unitless-zero": true,
"vendor-prefix-align": true,
"sort-order": [
// ....
]
} For me, csscomb stops working if the scss file has an @-rule or a scoped variable in it: // doesn't work
#header {
width: 100%;
@include blackBg;
}
// doesn't work
#header {
width: 100%;
$headerHeight: 64px;
}
// does work
#header {
width: 100%;
height: $headerHeight;
}
// does work
#header {
width: 100%;
#{$bg}-color: blue
} In the cases it doesn't work, csscomb throws me an error:
When I remove my sort-order property from the config, everything works fine. :) |
This should be fixed in the latest release now that the a = a.node.first().first().content;
b = b.node.first().first().content; |
still getting this issue |
Hi @JiniHendrix! Can you create a small repro repo that demonstrates the issue for me to investigate. |
hey @jdalton here's an example repo https://github.com/JiniHendrix/csscomb-sort-break thanks! |
Thank you @JiniHendrix! Yep, the issue still persists. Let's fix it together! |
ill give it a shot 👍 |
Rock! The issue is that because left-overs can be a variety of things, one of those being a Variable node which has |
@jdalton looks like there already is a test for it, and it's passing. may need to refactor the tests. test/options/sort-order/process/test.js line 413 |
dont really have the time for it unfortunately, seems like you know how to fix the issue though? |
Ah okay, sorry. I posted my initial reply before the newer comments popped in. No worries. Thanks for pin pointing the existing test! Update: Patch PR started at #609. |
Fix error when sorting leftover variable definitions. [closes #443]
hey @jdalton thanks for fixing the issue. any idea when this will be published? |
Produces:
I did a bit of debugging:
This is
sortLeftovers
function fromsort-order.js
that triggers the error.The output of
console.log
is:The text was updated successfully, but these errors were encountered: