Skip to content
This repository has been archived by the owner on Mar 26, 2023. It is now read-only.

Commit

Permalink
patch comma line breaks based on original data
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Dec 21, 2022
1 parent ca4fc11 commit ca814b7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/language-css/printer-postcss.js
Original file line number Diff line number Diff line change
Expand Up @@ -905,12 +905,17 @@ function genericPrint(path, options, print) {
}

if (!node.open) {
const origValueText = options.originalText.slice(
locStart(path.getParentNode(2)),
locEnd(path.getParentNode(2))
);
const forceHardLine = origValueText.includes("\n");
const printed = path.map(print, "groups");
const res = [hardline];
const res = forceHardLine ? [hardline] : [];

for (let i = 0; i < printed.length; i++) {
if (i !== 0) {
res.push([",", hardline]);
res.push([",", forceHardLine ? hardline : line]);

This comment has been minimized.

Copy link
@lubber-de

lubber-de Dec 21, 2022

Member

Do we have to worry about the linter error?

This comment has been minimized.

Copy link
@mvorisek

mvorisek Dec 21, 2022

Author

we don't have to, nor the tests, it is enought Prettier can finish on Fomantic-UI /wo any unwanted changes

}
res.push(printed[i]);
}
Expand Down

0 comments on commit ca814b7

Please sign in to comment.