@putout/printer 14.2.0 → 14.3.0
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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const {types} = require('@putout/babel');
|
|
3
4
|
const {
|
|
4
5
|
isNext,
|
|
5
6
|
isLast,
|
|
@@ -15,6 +16,11 @@ const {
|
|
|
15
16
|
|
|
16
17
|
const {isInsideAssignNextAssignFunction} = require('./is-inside-assign-next-assign-function');
|
|
17
18
|
|
|
19
|
+
const {
|
|
20
|
+
isCallExpression,
|
|
21
|
+
isExpressionStatement,
|
|
22
|
+
} = types;
|
|
23
|
+
|
|
18
24
|
const not = (fn) => (...a) => !fn(...a);
|
|
19
25
|
|
|
20
26
|
const isBeforeElse = (path) => {
|
|
@@ -69,7 +75,7 @@ module.exports.ExpressionStatement = {
|
|
|
69
75
|
|
|
70
76
|
if (!insideReturn && shouldBreakline(path)) {
|
|
71
77
|
print.newline();
|
|
72
|
-
maybe.indent(isNext(path) && noTrailingComment(path));
|
|
78
|
+
maybe.indent(isNext(path) && noTrailingComment(path) || isNextCallWithLeadingComment(path));
|
|
73
79
|
store(true);
|
|
74
80
|
}
|
|
75
81
|
},
|
|
@@ -141,3 +147,14 @@ function isStrictMode(path) {
|
|
|
141
147
|
|
|
142
148
|
return value === 'use strict';
|
|
143
149
|
}
|
|
150
|
+
|
|
151
|
+
function isNextCallWithLeadingComment(path) {
|
|
152
|
+
const nextPath = path.getNextSibling();
|
|
153
|
+
|
|
154
|
+
if (!isExpressionStatement(nextPath))
|
|
155
|
+
return false;
|
|
156
|
+
|
|
157
|
+
const {expression} = nextPath.node;
|
|
158
|
+
|
|
159
|
+
return isCallExpression(expression);
|
|
160
|
+
}
|
package/package.json
CHANGED