This repository has been archived by the owner on Mar 26, 2023. It is now read-only.
forked from prettier/prettier
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
patch comma line breaks based on original data
- Loading branch information
Showing
1 changed file
with
7 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
mvorisek
Author
|
||
} | ||
res.push(printed[i]); | ||
} | ||
|
Do we have to worry about the linter error?