Don't print extra semicolon after prettier-ignored index-signature (#17538)
* Don't print extra semicolon after `prettier-ignore`d index-signature * Update snapshots * Add changelog
This commit is contained in:
1 parent
c757fdbccd
commit
0f553baffc
4 files changed
+48
-1
No files matched your search
@@ -0,0 +1,22 @@
|
|||||||
|
#### Don't print extra semicolon after `prettier-ignore`d index-signature (#17538 by @sosukesuzuki)
|
||||||
|
|
||||||
|
<!-- prettier-ignore -->
|
||||||
|
```tsx
|
||||||
|
// Input
|
||||||
|
type foo = {
|
||||||
|
// prettier-ignore
|
||||||
|
[key: string]: bar;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Prettier stable
|
||||||
|
type foo = {
|
||||||
|
// prettier-ignore
|
||||||
|
[key: string]: bar;;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Prettier main
|
||||||
|
type foo = {
|
||||||
|
// prettier-ignore
|
||||||
|
[key: string]: bar;
|
||||||
|
};
|
||||||
|
```
|
||||||
@@ -159,7 +159,8 @@ function printObject(path, options, print) {
|
|||||||
((lastElem.type === "TSPropertySignature" ||
|
((lastElem.type === "TSPropertySignature" ||
|
||||||
lastElem.type === "TSCallSignatureDeclaration" ||
|
lastElem.type === "TSCallSignatureDeclaration" ||
|
||||||
lastElem.type === "TSMethodSignature" ||
|
lastElem.type === "TSMethodSignature" ||
|
||||||
lastElem.type === "TSConstructSignatureDeclaration") &&
|
lastElem.type === "TSConstructSignatureDeclaration" ||
|
||||||
|
lastElem.type === "TSIndexSignature") &&
|
||||||
hasComment(lastElem, CommentCheckFlags.PrettierIgnore))))
|
hasComment(lastElem, CommentCheckFlags.PrettierIgnore))))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,26 @@ export const foo = // prettier-ignore
|
|||||||
================================================================================
|
================================================================================
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`issue-16927.ts format 1`] = `
|
||||||
|
====================================options=====================================
|
||||||
|
parsers: ["typescript"]
|
||||||
|
printWidth: 80
|
||||||
|
| printWidth
|
||||||
|
=====================================input======================================
|
||||||
|
type Foo = {
|
||||||
|
// prettier-ignore
|
||||||
|
[key: string]: bar;
|
||||||
|
};
|
||||||
|
|
||||||
|
=====================================output=====================================
|
||||||
|
type Foo = {
|
||||||
|
// prettier-ignore
|
||||||
|
[key: string]: bar;
|
||||||
|
};
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`mapped-types.ts format 1`] = `
|
exports[`mapped-types.ts format 1`] = `
|
||||||
====================================options=====================================
|
====================================options=====================================
|
||||||
parsers: ["typescript"]
|
parsers: ["typescript"]
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
type Foo = {
|
||||||
|
// prettier-ignore
|
||||||
|
[key: string]: bar;
|
||||||
|
};
|
||||||
Reference in new issue
Block a user