Fix formatting of lists in SCSS property/variable values (#5710)

This commit is contained in:
Jarda Snajdr authored and Ika committed 2019-01-10 00:08:34 +08:00
1 parent e83490a90e
commit 5847c168e4
3 files changed
+15 -12

No files matched your search

+2 -12
View File
@@ -625,19 +625,9 @@ function genericPrint(path, options, print) {
continue;
}
// Ignore inline comment, they already contain newline at end (i.e. `// Comment`)
// Add `hardline` after inline comment (i.e. `// comment\n foo: bar;`)
const isInlineComment = isInlineValueCommentNode(iNode);
if (
(iPrevNode && isInlineValueCommentNode(iPrevNode)) ||
isInlineComment ||
isInlineValueCommentNode(iNextNode)
) {
if (isInlineComment) {
parts.push(hardline);
}
if (isInlineValueCommentNode(iNode)) {
parts.push(hardline);
continue;
}
@@ -699,11 +699,19 @@ $my-list:
'foo', // Foo
'bar'; // Bar
$my-list2:
a // a
b
c;
=====================================output=====================================
$my-list: "foo",
// Foo
"bar"; // Bar
$my-list2: a // a
b c;
================================================================================
`;
+5
View File
@@ -1,3 +1,8 @@
$my-list:
'foo', // Foo
'bar'; // Bar
$my-list2:
a // a
b
c;