Visitar URL original
Fix · prettier/prettier@ca467b7 · GitHub
Skip to content

Commit ca467b7

Browse files
committed
Fix
1 parent f8e9b14 commit ca467b7

3 files changed

Lines changed: 12 additions & 11 deletions

File tree

‎src/language-js/print/class-body.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ function printClassBody(path, options, print) {
117117
if (parts.length === 0) {
118118
content = openingBrace + closingBrace;
119119
} else {
120-
const spacing = isEmpty ? "" : options.bracketSpacing ? line : softline;
120+
const spacing =
121+
!options.bracketSpacing || (isEmpty && !shouldBreak) ? softline : line;
121122
content = [
122123
openingBrace,
123124
indent([spacing, ...parts]),

‎tests/format/flow/object-inexact/comments/__snapshots__/format.test.js.snap‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ T6 = {/* comment */ // comment
4343
};
4444
4545
=====================================output=====================================
46-
type T1 = {| /* comment */ |};
47-
type T12 = { /* comment */ };
46+
type T1 = {|/* comment */|};
47+
type T12 = {/* comment */};
4848
T1 = {/* comment */};
4949
50-
type T2 = {| /* comment */ |};
51-
type T22 = { /* comment */ };
50+
type T2 = {|/* comment */|};
51+
type T22 = {/* comment */};
5252
T2 = {/* comment */};
5353
54-
type T3 = {| /* comment */ |};
55-
type T32 = { /* comment */ };
54+
type T3 = {|/* comment */|};
55+
type T32 = {/* comment */};
5656
T3 = {/* comment */};
5757
5858
type T4 = {|

‎tests/format/typescript/class-and-interface/empty/__snapshots__/format.test.js.snap‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ type T2 = {
6363
type T3 = {
6464
//comment
6565
};
66-
type T4 = { /*comment*/ };
67-
type T5 = { /*comment*/ };
68-
type T6 = { /*comment*/ };
69-
type T7 = { /*comment*/ };
66+
type T4 = {/*comment*/};
67+
type T5 = {/*comment*/};
68+
type T6 = {/*comment*/};
69+
type T7 = {/*comment*/};
7070
7171
================================================================================
7272
`;

0 commit comments

Comments
 (0)