diff --git a/src/language-js/printer-estree.js b/src/language-js/printer-estree.js index 1dcc334951e0..b2899c3b067a 100644 --- a/src/language-js/printer-estree.js +++ b/src/language-js/printer-estree.js @@ -1180,7 +1180,8 @@ function printPathNoParens(path, options, print, args) { const result = concat(separatorParts.concat(group(prop.printed))); separatorParts = [separator, line]; if ( - prop.node.type === "TSPropertySignature" && + (prop.node.type === "TSPropertySignature" || + prop.node.type === "TSMethodSignature") && hasNodeIgnoreComment(prop.node) ) { separatorParts.shift(); diff --git a/tests/typescript_interface/__snapshots__/jsfmt.spec.js.snap b/tests/typescript_interface/__snapshots__/jsfmt.spec.js.snap index d4f8741d558f..0ba8fd790592 100644 --- a/tests/typescript_interface/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript_interface/__snapshots__/jsfmt.spec.js.snap @@ -59,6 +59,14 @@ interface Interface { prop: type prop: type } + +interface foo extends bar { + // prettier-ignore + f(): void; + // prettier-ignore + g(): void; + h(): void; +} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ interface Interface { // prettier-ignore @@ -75,6 +83,14 @@ interface Interface { prop: type; } +interface foo extends bar { + // prettier-ignore + f(): void; + // prettier-ignore + g(): void; + h(): void; +} + `; exports[`ignore.js - typescript-verify 2`] = ` @@ -92,6 +108,14 @@ interface Interface { prop: type prop: type } + +interface foo extends bar { + // prettier-ignore + f(): void; + // prettier-ignore + g(): void; + h(): void; +} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ interface Interface { // prettier-ignore @@ -108,6 +132,14 @@ interface Interface { prop: type } +interface foo extends bar { + // prettier-ignore + f(): void; + // prettier-ignore + g(): void; + h(): void +} + `; exports[`long-extends.ts - typescript-verify 1`] = ` diff --git a/tests/typescript_interface/ignore.js b/tests/typescript_interface/ignore.js index 13fb8dfd1b13..163c21ba12d6 100644 --- a/tests/typescript_interface/ignore.js +++ b/tests/typescript_interface/ignore.js @@ -12,3 +12,11 @@ interface Interface { prop: type prop: type } + +interface foo extends bar { + // prettier-ignore + f(): void; + // prettier-ignore + g(): void; + h(): void; +}