@putout/printer 15.1.3 → 15.2.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
|
@@ -60,7 +60,12 @@ const isSiblingIsArray = (path) => {
|
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
module.exports.isMultiLine = (path, {elements, maxElementsInOneLine}) => {
|
|
63
|
-
|
|
63
|
+
const [first] = elements;
|
|
64
|
+
|
|
65
|
+
if (elements.length > maxElementsInOneLine && isStringLiteral(first))
|
|
66
|
+
return MULTI_LINE;
|
|
67
|
+
|
|
68
|
+
if (elements.length > 3 && !isObjectExpression(first))
|
|
64
69
|
return MULTI_LINE;
|
|
65
70
|
|
|
66
71
|
if (isSimpleAndNotEmptyObject(elements))
|
|
@@ -133,7 +138,7 @@ const isForOf = ({parentPath}) => parentPath.isForOfStatement();
|
|
|
133
138
|
|
|
134
139
|
const isStringAndString = ([a, b]) => isStringLiteral(a) && isStringLiteral(b);
|
|
135
140
|
|
|
136
|
-
const isShortTwoSimplesInsideCall = (path,
|
|
141
|
+
const isShortTwoSimplesInsideCall = (path, maxElementsInOneLine) => {
|
|
137
142
|
const {node, parentPath} = path;
|
|
138
143
|
|
|
139
144
|
const {elements} = node;
|
|
@@ -146,7 +151,7 @@ const isShortTwoSimplesInsideCall = (path, short) => {
|
|
|
146
151
|
if (!isStringLiteral(a) || !isStringLiteral(b))
|
|
147
152
|
return false;
|
|
148
153
|
|
|
149
|
-
return length <
|
|
154
|
+
return length < maxElementsInOneLine;
|
|
150
155
|
};
|
|
151
156
|
|
|
152
157
|
const isTwoSimplesInsideObjectProperty = (path) => {
|
|
@@ -15,22 +15,22 @@ const {maybeTypeAnnotation} = require('../../maybe/maybe-type-annotation');
|
|
|
15
15
|
const {moreThenMaxPropertiesLengthInOneLine} = require('./more-then-max-properties-length-in-one-line');
|
|
16
16
|
const {printKey} = require('../object-expression/print-key');
|
|
17
17
|
|
|
18
|
-
const isInsideFn = (path) => {
|
|
19
|
-
if (isFunction(path.parentPath))
|
|
20
|
-
return true;
|
|
21
|
-
|
|
22
|
-
return isFunction(path.parentPath.parentPath);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
18
|
const {
|
|
19
|
+
isObjectExpression,
|
|
26
20
|
isIdentifier,
|
|
27
|
-
isObjectPattern,
|
|
28
21
|
isAssignmentPattern,
|
|
29
|
-
isObjectExpression,
|
|
30
22
|
isVariableDeclarator,
|
|
31
23
|
isFunction,
|
|
24
|
+
isObjectPattern,
|
|
32
25
|
} = types;
|
|
33
26
|
|
|
27
|
+
const isInsideFn = (path) => {
|
|
28
|
+
if (isFunction(path.parentPath))
|
|
29
|
+
return true;
|
|
30
|
+
|
|
31
|
+
return isFunction(path.parentPath.parentPath);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
34
|
function isIndent(path) {
|
|
35
35
|
return !path.parentPath.isArrayPattern();
|
|
36
36
|
}
|
package/package.json
CHANGED