@putout/printer 1.82.2 → 1.83.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
|
@@ -20,7 +20,8 @@ const SECOND = 1;
|
|
|
20
20
|
const isStringAndArray = ([a, b]) => isStringLiteral(a) && isArrayExpression(b);
|
|
21
21
|
const isStringAndString = ([a, b]) => isStringLiteral(a) && isStringLiteral(b);
|
|
22
22
|
const isIdentifierAndIdentifier = ([a, b]) => isIdentifier(a) && isIdentifier(b);
|
|
23
|
-
const
|
|
23
|
+
const isInsideArray = (path) => path.parentPath.isArrayExpression();
|
|
24
|
+
const isStringAndCall = ([a, b]) => isStringLiteral(a) && isCallExpression(b);
|
|
24
25
|
|
|
25
26
|
const isTwoLongStrings = ([a, b]) => {
|
|
26
27
|
const LONG_STRING = 20;
|
|
@@ -83,7 +84,7 @@ module.exports.ArrayExpression = {
|
|
|
83
84
|
|
|
84
85
|
const parentElements = path.parentPath.get('elements');
|
|
85
86
|
|
|
86
|
-
if (
|
|
87
|
+
if (isInsideArray(path) && isStringAndArray(parentElements)) {
|
|
87
88
|
indent.dec();
|
|
88
89
|
maybe.indent(elements.length && isNewLine);
|
|
89
90
|
indent.inc();
|
|
@@ -220,6 +221,9 @@ function isNewlineBetweenElements(path, {elements}) {
|
|
|
220
221
|
if (isInsideLoop(path))
|
|
221
222
|
return false;
|
|
222
223
|
|
|
224
|
+
if (isStringAndCall(elements))
|
|
225
|
+
return false;
|
|
226
|
+
|
|
223
227
|
if (isTwoStringsDifferentLength(elements))
|
|
224
228
|
return false;
|
|
225
229
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/printer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.83.1",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
|
-
"description": "Simplest possible opinionated Babel AST printer
|
|
6
|
+
"description": "Simplest possible opinionated Babel AST printer for 🐊Putout",
|
|
7
7
|
"homepage": "https://github.com/putoutjs/printer#readme",
|
|
8
8
|
"main": "./lib/printer.js",
|
|
9
9
|
"exports": {
|