Support "// prettier-ignore" in comment blocks (#1125)

* // prettier-ignore has to be last comment

* Add test for #1109
This commit is contained in:
Eric Clemmons authored and Christopher Chedeau committed 2017-04-05 10:08:08 -07:00
1 parent 3ddd6c9271
commit def91efd16
3 files changed
+25 -1

No files matched your search

+1 -1
View File
@@ -65,7 +65,7 @@ function genericPrint(path, options, printPath) {
if (
node.comments &&
node.comments.length > 0 &&
node.comments[0].value.trim() === "prettier-ignore"
node.comments[node.comments.length - 1].value.trim() === "prettier-ignore"
) {
return options.originalText.slice(util.locStart(node), util.locEnd(node));
}
@@ -18,6 +18,14 @@ exports[`ignore.js 1`] = `
0, 0, 0
);
// Let's make sure that this comment doesn't interfere
// prettier-ignore
const commentsWithPrettierIgnore = {
\\"ewww\\":
\\"gross-formatting\\",
};
// prettier-ignore
console.error(
'In order to use ' + prompt + ', you need to configure a ' +
@@ -69,6 +77,14 @@ function a() {
0, 0, 0
);
// Let's make sure that this comment doesn't interfere
// prettier-ignore
const commentsWithPrettierIgnore = {
\\"ewww\\":
\\"gross-formatting\\",
};
// prettier-ignore
console.error(
'In order to use ' + prompt + ', you need to configure a ' +
+8
View File
@@ -15,6 +15,14 @@ function a() {
0, 0, 0
);
// Let's make sure that this comment doesn't interfere
// prettier-ignore
const commentsWithPrettierIgnore = {
"ewww":
"gross-formatting",
};
// prettier-ignore
console.error(
'In order to use ' + prompt + ', you need to configure a ' +