Fix formatting of lists in SCSS property/variable values (#5710)
parent
e83490a90e
commit
5847c168e4
|
@ -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;
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
$my-list:
|
||||
'foo', // Foo
|
||||
'bar'; // Bar
|
||||
|
||||
$my-list2:
|
||||
a // a
|
||||
b
|
||||
c;
|
||||
|
|
Loading…
Reference in New Issue