@putout/printer 18.52.1 → 18.52.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ChangeLog
CHANGED
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
|
|
13
13
|
const {
|
|
14
14
|
isArrowFunctionExpression,
|
|
15
|
-
isObjectProperty,
|
|
16
15
|
isVariableDeclarator,
|
|
17
16
|
isClassProperty,
|
|
18
17
|
isTSPropertySignature,
|
|
@@ -24,7 +23,6 @@ const {
|
|
|
24
23
|
} = types;
|
|
25
24
|
|
|
26
25
|
const isProperty = satisfy([
|
|
27
|
-
isObjectProperty,
|
|
28
26
|
isClassProperty,
|
|
29
27
|
isTSPropertySignature,
|
|
30
28
|
isSpreadElement,
|
|
@@ -166,17 +164,13 @@ export const parseLeadingComments = (path, printer, semantics, {currentTraverse
|
|
|
166
164
|
|
|
167
165
|
const looksLikeMethod = path.isClassMethod();
|
|
168
166
|
const looksLikeDirective = path.isDirective();
|
|
169
|
-
const looksLikeProp = path.isObjectProperty();
|
|
170
|
-
|
|
171
|
-
if (looksLikeProp)
|
|
172
|
-
print.breakline();
|
|
173
167
|
|
|
174
168
|
print(`/*${value}*/`);
|
|
175
169
|
|
|
176
|
-
if (path.isStatement() || path.isTSEnumMember() || looksLikeDirective || looksLikeMethod ||
|
|
170
|
+
if (path.isStatement() || path.isTSEnumMember() || looksLikeDirective || looksLikeMethod || looksLikeSwitchCase) {
|
|
177
171
|
print.newline();
|
|
178
172
|
markBefore(path);
|
|
179
|
-
maybe.indent(looksLikeMethod ||
|
|
173
|
+
maybe.indent(looksLikeMethod || looksLikeSwitchCase);
|
|
180
174
|
}
|
|
181
175
|
|
|
182
176
|
continue;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {isConcatenation} from '#is-concatenation';
|
|
2
|
+
import {markBefore} from '#mark';
|
|
2
3
|
import {isMultiline} from './object-expression.js';
|
|
3
4
|
import {printKey} from './print-key.js';
|
|
4
5
|
import {isCommaAfterProperty} from './comma.js';
|
|
@@ -31,3 +32,37 @@ export const ObjectProperty = (path, printer, semantics) => {
|
|
|
31
32
|
if (isSpaceAfterComma(path, {multiline}))
|
|
32
33
|
write.space();
|
|
33
34
|
};
|
|
35
|
+
|
|
36
|
+
const isFirst = (path) => path === path.parentPath.get('properties')[0];
|
|
37
|
+
|
|
38
|
+
ObjectProperty.printLeadingCommentLine = (path, printer, semantics, {printComment, isLast, isPreviousLine}) => {
|
|
39
|
+
const {print, maybe} = printer;
|
|
40
|
+
const first = isFirst(path);
|
|
41
|
+
|
|
42
|
+
maybe.indent(first);
|
|
43
|
+
|
|
44
|
+
if (isPreviousLine())
|
|
45
|
+
maybe.print.breakline(!first);
|
|
46
|
+
else
|
|
47
|
+
print.space();
|
|
48
|
+
|
|
49
|
+
printComment();
|
|
50
|
+
|
|
51
|
+
if (isLast) {
|
|
52
|
+
print.breakline();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
print.newline();
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
ObjectProperty.printLeadingCommentBlock = (path, printer, semantics, {printComment}) => {
|
|
60
|
+
const {maybe, indent} = printer;
|
|
61
|
+
const first = isFirst(path);
|
|
62
|
+
|
|
63
|
+
maybe.indent(first);
|
|
64
|
+
maybe.print.breakline(!first);
|
|
65
|
+
printComment();
|
|
66
|
+
markBefore(path);
|
|
67
|
+
indent();
|
|
68
|
+
};
|
package/package.json
CHANGED