@putout/printer 1.81.3 → 1.81.4
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
package/README.md
CHANGED
package/lib/tokenize/comments.js
CHANGED
|
@@ -61,9 +61,9 @@ module.exports.parseTrailingComments = (path, {write, maybe}, format) => {
|
|
|
61
61
|
return;
|
|
62
62
|
|
|
63
63
|
for (const {type, value, loc} of trailingComments) {
|
|
64
|
+
const sameLine = isSameLine(path, loc);
|
|
65
|
+
|
|
64
66
|
if (type === 'CommentLine') {
|
|
65
|
-
const sameLine = isSameLine(path, loc);
|
|
66
|
-
|
|
67
67
|
maybe.write.space(sameLine);
|
|
68
68
|
maybe.indent(!sameLine);
|
|
69
69
|
|
|
@@ -73,8 +73,9 @@ module.exports.parseTrailingComments = (path, {write, maybe}, format) => {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
if (type === 'CommentBlock') {
|
|
76
|
+
maybe.write.space(sameLine);
|
|
76
77
|
write(`/*${value}*/`);
|
|
77
|
-
write.newline();
|
|
78
|
+
maybe.write.newline(!sameLine);
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
};
|
|
@@ -28,7 +28,7 @@ module.exports.ObjectExpression = (path, {print, maybe, indent}) => {
|
|
|
28
28
|
|
|
29
29
|
maybe.print(parens, '(');
|
|
30
30
|
print('{');
|
|
31
|
-
maybe.print(manyLines
|
|
31
|
+
maybe.print.newline(manyLines);
|
|
32
32
|
|
|
33
33
|
for (const property of properties) {
|
|
34
34
|
if (property.isSpreadElement()) {
|
|
@@ -5,6 +5,8 @@ const {isIdentifier} = require('@babel/types');
|
|
|
5
5
|
const {
|
|
6
6
|
isForOf,
|
|
7
7
|
isCoupleLines,
|
|
8
|
+
exists,
|
|
9
|
+
|
|
8
10
|
} = require('../is');
|
|
9
11
|
|
|
10
12
|
module.exports.ObjectPattern = (path, {indent, print, maybe}) => {
|
|
@@ -27,16 +29,16 @@ module.exports.ObjectPattern = (path, {indent, print, maybe}) => {
|
|
|
27
29
|
const keyPath = property.get('key');
|
|
28
30
|
const isAssign = valuePath.isAssignmentPattern();
|
|
29
31
|
const {shorthand} = property.node;
|
|
32
|
+
const couple = isCoupleLines(valuePath) && !exists(property.getPrevSibling());
|
|
30
33
|
|
|
31
34
|
maybe.indent(is);
|
|
32
|
-
maybe.print(
|
|
35
|
+
maybe.print.breakline(couple);
|
|
36
|
+
print(keyPath);
|
|
33
37
|
|
|
34
38
|
if (!shorthand) {
|
|
35
39
|
print(': ');
|
|
36
40
|
print(valuePath);
|
|
37
41
|
} else if (isAssign) {
|
|
38
|
-
const couple = isCoupleLines(valuePath);
|
|
39
|
-
maybe.print.breakline(couple);
|
|
40
42
|
print(valuePath);
|
|
41
43
|
|
|
42
44
|
maybe.print(couple, ',');
|
package/package.json
CHANGED