@putout/printer 2.13.1 → 2.14.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
|
@@ -11,6 +11,7 @@ const {
|
|
|
11
11
|
isBooleanLiteral,
|
|
12
12
|
isNullLiteral,
|
|
13
13
|
isStringLiteral,
|
|
14
|
+
isSpreadElement,
|
|
14
15
|
} = require('@babel/types');
|
|
15
16
|
|
|
16
17
|
const {
|
|
@@ -24,6 +25,15 @@ const {
|
|
|
24
25
|
|
|
25
26
|
const {round} = Math;
|
|
26
27
|
|
|
28
|
+
const isOneSpread = (elements) => {
|
|
29
|
+
if (elements.length > 1)
|
|
30
|
+
return false;
|
|
31
|
+
|
|
32
|
+
const [first] = elements;
|
|
33
|
+
|
|
34
|
+
return isSpreadElement(first);
|
|
35
|
+
};
|
|
36
|
+
|
|
27
37
|
const isSimpleAndCall = ([a, b]) => {
|
|
28
38
|
if (!isSimple(a))
|
|
29
39
|
return;
|
|
@@ -44,6 +54,9 @@ module.exports.isNewlineBetweenElements = (path, {elements, maxElementsInOneLine
|
|
|
44
54
|
if (isOneSimple(path))
|
|
45
55
|
return ONE_LINE;
|
|
46
56
|
|
|
57
|
+
if (isOneSpread(elements))
|
|
58
|
+
return ONE_LINE;
|
|
59
|
+
|
|
47
60
|
if (elements.length === 2 && isIdentifierAndIdentifier(elements))
|
|
48
61
|
return ONE_LINE;
|
|
49
62
|
|
package/package.json
CHANGED