@putout/printer 2.3.0 → 2.4.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
|
@@ -79,6 +79,17 @@ const hasNextLeadingComment = (path) => {
|
|
|
79
79
|
return hasLeadingComment(next);
|
|
80
80
|
};
|
|
81
81
|
|
|
82
|
+
const notLastArgInsideCall = (path) => {
|
|
83
|
+
const {parentPath} = path;
|
|
84
|
+
|
|
85
|
+
if (!parentPath.isCallExpression())
|
|
86
|
+
return false;
|
|
87
|
+
|
|
88
|
+
return path !== parentPath
|
|
89
|
+
.get('arguments')
|
|
90
|
+
.at(-1);
|
|
91
|
+
};
|
|
92
|
+
|
|
82
93
|
function shouldAddNewline(path) {
|
|
83
94
|
if (!path.parentPath.isLogicalExpression())
|
|
84
95
|
return false;
|
|
@@ -96,6 +107,9 @@ function isOneLine(path) {
|
|
|
96
107
|
if (!length)
|
|
97
108
|
return true;
|
|
98
109
|
|
|
110
|
+
if (notLastArgInsideCall(path))
|
|
111
|
+
return ONE_LINE;
|
|
112
|
+
|
|
99
113
|
if (isForOf(path))
|
|
100
114
|
return ONE_LINE;
|
|
101
115
|
|
package/package.json
CHANGED