@putout/printer 1.26.0 → 1.27.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
|
@@ -16,6 +16,7 @@ const {
|
|
|
16
16
|
const isForOf = ({parentPath}) => parentPath.isForOfStatement();
|
|
17
17
|
const SECOND = 1;
|
|
18
18
|
const isStringAndArray = ([a, b]) => isStringLiteral(a) && isArrayExpression(b);
|
|
19
|
+
const isStringAndString = ([a, b]) => isStringLiteral(a) && isStringLiteral(b);
|
|
19
20
|
const isArrayParent = (path) => path.parentPath.isArrayExpression();
|
|
20
21
|
|
|
21
22
|
const isTwoLongStrings = ([a, b]) => {
|
|
@@ -58,6 +59,7 @@ module.exports.ArrayExpression = {
|
|
|
58
59
|
const isNewLine = isNewlineBetweenElements(path, {
|
|
59
60
|
elements,
|
|
60
61
|
});
|
|
62
|
+
|
|
61
63
|
const n = elements.length - 1;
|
|
62
64
|
|
|
63
65
|
maybe.print.newline(isNewLine && elements.length);
|
|
@@ -180,6 +182,9 @@ function isNewlineBetweenElements(path, {elements}) {
|
|
|
180
182
|
if (isStringAndIdentifier(elements))
|
|
181
183
|
return false;
|
|
182
184
|
|
|
185
|
+
if (isStringAndString(elements) && path.parentPath.isArrayExpression() && isArrayExpression(path.parentPath.node.elements[0]))
|
|
186
|
+
return false;
|
|
187
|
+
|
|
183
188
|
if (tooLong(path) || isCoupleLines(path) || !isNumbers(elements) && !isForOf(path) && isLastArg(path) && !isParentProperty(path))
|
|
184
189
|
return true;
|
|
185
190
|
|
|
@@ -197,6 +202,7 @@ function isTwoStringsDifferentLength(strings) {
|
|
|
197
202
|
|
|
198
203
|
const aLength = a
|
|
199
204
|
.node.value.length;
|
|
205
|
+
|
|
200
206
|
const bLength = b
|
|
201
207
|
.node.value.length;
|
|
202
208
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/printer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.27.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "Easiest possible opinionated Babel AST printer made with ❤️ to use in 🐊Putout",
|