@putout/printer 18.2.8 → 18.2.9
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
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
import {isObjectAfterSimple} from './is-object-after-simple.js';
|
|
19
19
|
import {
|
|
20
20
|
isArrayInsideArray,
|
|
21
|
+
isHideIndent,
|
|
21
22
|
isNeedIndent,
|
|
22
23
|
} from './indent.js';
|
|
23
24
|
import {
|
|
@@ -28,17 +29,12 @@ import {
|
|
|
28
29
|
const {
|
|
29
30
|
isObjectExpression,
|
|
30
31
|
isSpreadElement,
|
|
31
|
-
isStringLiteral,
|
|
32
32
|
isIdentifier,
|
|
33
33
|
isFunction,
|
|
34
34
|
isCallExpression,
|
|
35
35
|
isObjectProperty,
|
|
36
36
|
} = types;
|
|
37
37
|
|
|
38
|
-
const isNextString = (path) => isStringLiteral(path.getNextSibling());
|
|
39
|
-
const isPrevString = (path) => isStringLiteral(path.getPrevSibling());
|
|
40
|
-
const isAroundStrings = (path) => isNextString(path) || isPrevString(path);
|
|
41
|
-
|
|
42
38
|
const isSpreadBeforeObject = (a) => {
|
|
43
39
|
if (!a.isObjectExpression())
|
|
44
40
|
return false;
|
|
@@ -132,17 +128,14 @@ export const ArrayExpression = {
|
|
|
132
128
|
|
|
133
129
|
maybe.indent.dec(needIndent);
|
|
134
130
|
|
|
135
|
-
const parentElements = path.parentPath.get('elements');
|
|
136
|
-
|
|
137
131
|
if (isInsideArray(path) && isStringAndArray(path.parentPath)) {
|
|
138
|
-
const
|
|
139
|
-
const isHideIdent = !isAroundStrings(path) || parentCountTwo;
|
|
132
|
+
const needsToHideIndent = isHideIndent(path);
|
|
140
133
|
|
|
141
|
-
maybe.indent.dec(
|
|
142
|
-
maybe.indent(
|
|
143
|
-
maybe.indent.inc(
|
|
134
|
+
maybe.indent.dec(needsToHideIndent);
|
|
135
|
+
maybe.indent(needsNewline);
|
|
136
|
+
maybe.indent.inc(needsToHideIndent);
|
|
144
137
|
} else if (!isArrayInsideArray(path) && !isObjectExpression(elements.at(-1))) {
|
|
145
|
-
maybe.indent(
|
|
138
|
+
maybe.indent(needsNewline);
|
|
146
139
|
}
|
|
147
140
|
|
|
148
141
|
if (isSimpleAndNotEmptyObject(path) && !isSpreadElement(elements.at(-1)) && !isCallExpression(elements.at(-1))) {
|
package/package.json
CHANGED