@putout/printer 1.150.0 → 1.150.1
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
|
@@ -22,6 +22,7 @@ const {
|
|
|
22
22
|
isIdentifierAndString,
|
|
23
23
|
isStringAndMember,
|
|
24
24
|
} = require('../../is');
|
|
25
|
+
|
|
25
26
|
const MAX_ARRAY_ELEMENTS_WHEN_USED_AS_ARGUMENT = 4;
|
|
26
27
|
|
|
27
28
|
const isForOf = ({parentPath}) => parentPath.isForOfStatement();
|
|
@@ -39,8 +40,12 @@ const isStringAndArray = ([a, b]) => {
|
|
|
39
40
|
};
|
|
40
41
|
|
|
41
42
|
const isStringAndString = ([a, b]) => isStringLiteral(a) && isStringLiteral(b);
|
|
43
|
+
|
|
42
44
|
const isShortTwoSimplesInsideCall = (path, short) => {
|
|
43
|
-
const {
|
|
45
|
+
const {
|
|
46
|
+
node,
|
|
47
|
+
parentPath,
|
|
48
|
+
} = path;
|
|
44
49
|
const {elements} = node;
|
|
45
50
|
const {length} = elements;
|
|
46
51
|
const [a, b] = elements;
|
|
@@ -48,11 +53,12 @@ const isShortTwoSimplesInsideCall = (path, short) => {
|
|
|
48
53
|
if (!parentPath.isCallExpression())
|
|
49
54
|
return false;
|
|
50
55
|
|
|
51
|
-
if (!
|
|
56
|
+
if (!isStringLiteral(a) || !isStringLiteral(b))
|
|
52
57
|
return false;
|
|
53
58
|
|
|
54
59
|
return length < short;
|
|
55
60
|
};
|
|
61
|
+
|
|
56
62
|
const isIdentifierAndIdentifier = ([a, b]) => isIdentifier(a) && isIdentifier(b);
|
|
57
63
|
const isInsideArray = (path) => path.parentPath.isArrayExpression();
|
|
58
64
|
|
|
@@ -66,6 +72,7 @@ const isSimpleAndCall = ([a, b]) => {
|
|
|
66
72
|
const isBooleanAndSimple = ([a, b]) => isBooleanLiteral(a) && isSimple(b);
|
|
67
73
|
const isNullAndSimple = ([a, b]) => isNullLiteral(a) && isSimple(b);
|
|
68
74
|
const isSimpleAndObject = ([a, b]) => isSimple(a) && isObjectExpression(b);
|
|
75
|
+
|
|
69
76
|
const isStringAndObject = (elements) => {
|
|
70
77
|
const first = elements.at(0);
|
|
71
78
|
const last = elements.at(-1);
|
|
@@ -350,4 +357,3 @@ const isOneElementCall = (path, {elements}) => {
|
|
|
350
357
|
|
|
351
358
|
return !isCallExpression(elements[0]);
|
|
352
359
|
};
|
|
353
|
-
|
|
@@ -29,11 +29,7 @@ const satisfyAfter = satisfy([
|
|
|
29
29
|
isNextUp,
|
|
30
30
|
]);
|
|
31
31
|
|
|
32
|
-
const shouldBreakline = satisfy([
|
|
33
|
-
isNewlineBetweenSiblings,
|
|
34
|
-
isNotLastBody,
|
|
35
|
-
isStrictMode,
|
|
36
|
-
]);
|
|
32
|
+
const shouldBreakline = satisfy([isNewlineBetweenSiblings, isNotLastBody, isStrictMode]);
|
|
37
33
|
|
|
38
34
|
module.exports.ExpressionStatement = {
|
|
39
35
|
print(path, {indent, print, maybe, store}) {
|
package/package.json
CHANGED