@putout/printer 14.3.0 → 14.3.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
|
@@ -31,12 +31,14 @@ function isArrayInsideArray(path) {
|
|
|
31
31
|
|
|
32
32
|
const parentElements = path.parentPath.node.elements;
|
|
33
33
|
const parentHasArrays = parentElements.filter(isArrayExpression).length;
|
|
34
|
-
const
|
|
34
|
+
const lastNotArray = !isArrayExpression(parentElements.at(-1));
|
|
35
35
|
|
|
36
|
-
if (parentHasArrays &&
|
|
36
|
+
if (parentHasArrays && lastNotArray)
|
|
37
37
|
return false;
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
const {length} = parentElements;
|
|
40
|
+
|
|
41
|
+
return length <= 3 && length !== 1;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
const isTwoLongStrings = ([a, b]) => {
|
|
@@ -64,7 +64,7 @@ module.exports.ExpressionStatement = {
|
|
|
64
64
|
before(path, {indent}) {
|
|
65
65
|
indent();
|
|
66
66
|
},
|
|
67
|
-
print(path, {print, maybe, store}) {
|
|
67
|
+
print(path, {print, maybe, store, indent}) {
|
|
68
68
|
const insideReturn = isInsideReturn(path);
|
|
69
69
|
|
|
70
70
|
print('__expression');
|
|
@@ -75,7 +75,15 @@ module.exports.ExpressionStatement = {
|
|
|
75
75
|
|
|
76
76
|
if (!insideReturn && shouldBreakline(path)) {
|
|
77
77
|
print.newline();
|
|
78
|
-
|
|
78
|
+
|
|
79
|
+
const condition = isNext(path)
|
|
80
|
+
&& noTrailingComment(path)
|
|
81
|
+
|| isNextCallWithLeadingComment(path)
|
|
82
|
+
|| isNextIf(path);
|
|
83
|
+
|
|
84
|
+
if (condition)
|
|
85
|
+
indent();
|
|
86
|
+
|
|
79
87
|
store(true);
|
|
80
88
|
}
|
|
81
89
|
},
|
package/package.json
CHANGED