prettier 2.0.0 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -10
- package/bin-prettier.js +568 -496
- package/doc.js +9 -3
- package/index.js +155 -121
- package/package.json +1 -1
- package/parser-babel.js +1 -1
- package/parser-flow.js +1 -1
- package/parser-graphql.js +1 -1
- package/parser-html.js +1 -1
- package/parser-markdown.js +8 -2
- package/parser-postcss.js +2 -2
- package/parser-typescript.js +3 -3
- package/standalone.js +136 -114
- package/third-party.js +1 -1
package/doc.js
CHANGED
|
@@ -1056,7 +1056,11 @@
|
|
|
1056
1056
|
}
|
|
1057
1057
|
|
|
1058
1058
|
function hasNodeIgnoreComment(node) {
|
|
1059
|
-
return node && node.comments && node.comments.length > 0 && node.comments.some(comment => comment.
|
|
1059
|
+
return node && (node.comments && node.comments.length > 0 && node.comments.some(comment => isNodeIgnoreComment(comment) && !comment.unignore) || node.prettierIgnore);
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
function isNodeIgnoreComment(comment) {
|
|
1063
|
+
return comment.value.trim() === "prettier-ignore";
|
|
1060
1064
|
}
|
|
1061
1065
|
|
|
1062
1066
|
function addCommentHelper(node, comment) {
|
|
@@ -1156,6 +1160,7 @@
|
|
|
1156
1160
|
printNumber,
|
|
1157
1161
|
hasIgnoreComment,
|
|
1158
1162
|
hasNodeIgnoreComment,
|
|
1163
|
+
isNodeIgnoreComment,
|
|
1159
1164
|
makeString,
|
|
1160
1165
|
addLeadingComment,
|
|
1161
1166
|
addDanglingComment,
|
|
@@ -1468,8 +1473,9 @@
|
|
|
1468
1473
|
const [ind, mode, doc] = cmds.pop();
|
|
1469
1474
|
|
|
1470
1475
|
if (typeof doc === "string") {
|
|
1471
|
-
|
|
1472
|
-
|
|
1476
|
+
const formatted = newLine !== "\n" && doc.includes("\n") ? doc.replace(/\n/g, newLine) : doc;
|
|
1477
|
+
out.push(formatted);
|
|
1478
|
+
pos += getStringWidth$1(formatted);
|
|
1473
1479
|
} else {
|
|
1474
1480
|
switch (doc.type) {
|
|
1475
1481
|
case "cursor":
|