@putout/printer 1.148.0 → 1.149.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
|
@@ -25,7 +25,18 @@ const {
|
|
|
25
25
|
|
|
26
26
|
const isForOf = ({parentPath}) => parentPath.isForOfStatement();
|
|
27
27
|
|
|
28
|
-
const
|
|
28
|
+
const isInsideOneElementArray = ({parentPath}) => parentPath.node.elements.length === 1;
|
|
29
|
+
|
|
30
|
+
const isStringAndArray = ([a, b]) => {
|
|
31
|
+
if (!isStringLiteral(a))
|
|
32
|
+
return false;
|
|
33
|
+
|
|
34
|
+
if (!isArrayExpression(b))
|
|
35
|
+
return false;
|
|
36
|
+
|
|
37
|
+
return !isStringAndIdentifier(b.node.elements);
|
|
38
|
+
};
|
|
39
|
+
|
|
29
40
|
const isStringAndString = ([a, b]) => isStringLiteral(a) && isStringLiteral(b);
|
|
30
41
|
const isIdentifierAndIdentifier = ([a, b]) => isIdentifier(a) && isIdentifier(b);
|
|
31
42
|
const isInsideArray = (path) => path.parentPath.isArrayExpression();
|
|
@@ -71,7 +82,7 @@ module.exports.ArrayExpression = {
|
|
|
71
82
|
if (isCoupleLines(parentPath))
|
|
72
83
|
return false;
|
|
73
84
|
|
|
74
|
-
if (isStringAndIdentifier(elements))
|
|
85
|
+
if (isStringAndIdentifier(elements) && isInsideOneElementArray(path))
|
|
75
86
|
return true;
|
|
76
87
|
|
|
77
88
|
return isIdentifierAndIdentifier(elements);
|
|
@@ -133,7 +144,7 @@ module.exports.ArrayExpression = {
|
|
|
133
144
|
if (isCoupleLines(parentPath))
|
|
134
145
|
return false;
|
|
135
146
|
|
|
136
|
-
if (isStringAndIdentifier(elements))
|
|
147
|
+
if (isStringAndIdentifier(elements) && isInsideOneElementArray(path))
|
|
137
148
|
return true;
|
|
138
149
|
|
|
139
150
|
return isIdentifierAndIdentifier(elements);
|
package/package.json
CHANGED