@putout/printer 8.4.0 → 8.5.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
|
@@ -27,6 +27,8 @@ const {
|
|
|
27
27
|
} = types;
|
|
28
28
|
|
|
29
29
|
const isNextString = (path) => isStringLiteral(path.getNextSibling());
|
|
30
|
+
const isPrevString = (path) => isStringLiteral(path.getPrevSibling());
|
|
31
|
+
const isAroundStrings = (path) => isNextString(path) || isPrevString(path);
|
|
30
32
|
const isNextObject = (a) => a.getNextSibling().isObjectExpression();
|
|
31
33
|
const isPrevObject = (a) => a.getPrevSibling().isObjectExpression();
|
|
32
34
|
const isObjectAfterSpread = (a) => isSpreadElement(a) && isNextObject(a) && !isPrevObject(a);
|
|
@@ -100,9 +102,12 @@ module.exports.ArrayExpression = {
|
|
|
100
102
|
const parentElements = path.parentPath.get('elements');
|
|
101
103
|
|
|
102
104
|
if (isInsideArray(path) && isStringAndArray(parentElements)) {
|
|
103
|
-
|
|
105
|
+
const parentCountTwo = parentElements.length === 2;
|
|
106
|
+
const isHideIdent = !isAroundStrings(path) || parentCountTwo;
|
|
107
|
+
|
|
108
|
+
maybe.indent.dec(isHideIdent);
|
|
104
109
|
maybe.indent(elements.length && isNewLine);
|
|
105
|
-
maybe.indent.inc(
|
|
110
|
+
maybe.indent.inc(isHideIdent);
|
|
106
111
|
} else if (!isArrayInsideArray(path) && !isObjectExpression(elements.at(-1))) {
|
|
107
112
|
maybe.indent(elements.length && isNewLine);
|
|
108
113
|
}
|
package/package.json
CHANGED