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/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.value.trim() === "prettier-ignore");
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
- out.push(doc);
1472
- pos += getStringWidth$1(doc);
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":