@putout/printer 8.31.0 → 8.32.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
|
@@ -173,14 +173,28 @@ function shouldAddNewline(path, semantics) {
|
|
|
173
173
|
maxPropertiesInOneLine,
|
|
174
174
|
});
|
|
175
175
|
|
|
176
|
+
const fnParam = isFunctionParam(path);
|
|
177
|
+
|
|
176
178
|
if (moreCount && !moreLength)
|
|
177
179
|
return ONE_LINE;
|
|
178
180
|
|
|
179
|
-
if (!
|
|
181
|
+
if (!fnParam && n && !isForOf(path) && checkLength(properties))
|
|
180
182
|
return COUPLE_LINES;
|
|
181
183
|
|
|
182
|
-
if (hasAssign(properties))
|
|
184
|
+
if (!fnParam && hasAssign(properties))
|
|
183
185
|
return COUPLE_LINES;
|
|
184
186
|
|
|
185
187
|
return parentPath.isObjectProperty();
|
|
186
188
|
}
|
|
189
|
+
|
|
190
|
+
function isFunctionParam(path) {
|
|
191
|
+
const {parentPath} = path;
|
|
192
|
+
|
|
193
|
+
if (parentPath.isFunction())
|
|
194
|
+
return true;
|
|
195
|
+
|
|
196
|
+
if (!parentPath.isAssignmentPattern())
|
|
197
|
+
return false;
|
|
198
|
+
|
|
199
|
+
return parentPath.parentPath.isFunction();
|
|
200
|
+
}
|
package/package.json
CHANGED