Support "// prettier-ignore" in comment blocks (#1125)
* // prettier-ignore has to be last comment * Add test for #1109
This commit is contained in:
1 parent
3ddd6c9271
commit
def91efd16
3 files changed
+25
-1
No files matched your search
+1
-1
@@ -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 ' +
|
||||
|
||||
@@ -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 ' +
|
||||
|
||||
Reference in new issue
Block a user