@putout/printer 1.131.0 → 1.133.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
|
@@ -8,6 +8,9 @@ const {
|
|
|
8
8
|
isArrayExpression,
|
|
9
9
|
isIdentifier,
|
|
10
10
|
isCallExpression,
|
|
11
|
+
isBooleanLiteral,
|
|
12
|
+
isObjectExpression,
|
|
13
|
+
|
|
11
14
|
} = require('@babel/types');
|
|
12
15
|
|
|
13
16
|
const {isSimple} = require('@putout/operate');
|
|
@@ -24,6 +27,7 @@ const isStringAndString = ([a, b]) => isStringLiteral(a) && isStringLiteral(b);
|
|
|
24
27
|
const isIdentifierAndIdentifier = ([a, b]) => isIdentifier(a) && isIdentifier(b);
|
|
25
28
|
const isInsideArray = (path) => path.parentPath.isArrayExpression();
|
|
26
29
|
const isSimpleAndCall = ([a, b]) => isSimple(a) && isCallExpression(b);
|
|
30
|
+
const isBooleanAndSimple = ([a, b]) => isBooleanLiteral(a) && isSimple(b);
|
|
27
31
|
|
|
28
32
|
const isTwoLongStrings = ([a, b]) => {
|
|
29
33
|
const LONG_STRING = 20;
|
|
@@ -209,7 +213,7 @@ function isOneSimple(path) {
|
|
|
209
213
|
}
|
|
210
214
|
|
|
211
215
|
function isNewlineBetweenElements(path, {elements}) {
|
|
212
|
-
if (elements.length > 3)
|
|
216
|
+
if (elements.length > 3 && !isObjectExpression(elements[0]))
|
|
213
217
|
return true;
|
|
214
218
|
|
|
215
219
|
if (isOneSimple(path))
|
|
@@ -230,6 +234,9 @@ function isNewlineBetweenElements(path, {elements}) {
|
|
|
230
234
|
if (isInsideLoop(path))
|
|
231
235
|
return false;
|
|
232
236
|
|
|
237
|
+
if (isBooleanAndSimple(elements))
|
|
238
|
+
return false;
|
|
239
|
+
|
|
233
240
|
if (isSimpleAndCall(elements))
|
|
234
241
|
return false;
|
|
235
242
|
|
package/package.json
CHANGED