@putout/printer 18.2.11 → 18.2.12
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 +5 -0
- package/lib/tokenize/expressions/array-expression/array-expression.js +1 -1
- package/lib/tokenize/expressions/array-expression/indent.js +4 -3
- package/lib/tokenize/expressions/array-expression/is.js +3 -0
- package/lib/tokenize/expressions/array-expression/newline.js +3 -3
- package/package.json +1 -1
package/ChangeLog
CHANGED
|
@@ -86,7 +86,7 @@ export const ArrayExpression = {
|
|
|
86
86
|
if (index < n || trailingComma)
|
|
87
87
|
maybe.print(is, ',');
|
|
88
88
|
|
|
89
|
-
if (
|
|
89
|
+
if (needsNewline && isNewlineAfterComma(element))
|
|
90
90
|
print.newline();
|
|
91
91
|
|
|
92
92
|
maybe.print.space(is && isObjectAfterSimple(element));
|
|
@@ -5,6 +5,10 @@ import {
|
|
|
5
5
|
isInsideCall,
|
|
6
6
|
isStringAndArray,
|
|
7
7
|
} from '#is';
|
|
8
|
+
import {
|
|
9
|
+
isNeedsNewlineOption,
|
|
10
|
+
isNeedsToHideIndentOption,
|
|
11
|
+
} from './is.js';
|
|
8
12
|
|
|
9
13
|
const isTwoLongStrings = (path) => {
|
|
10
14
|
const [a, b] = path.node.elements;
|
|
@@ -104,9 +108,6 @@ export const isHideIndent = createTypeChecker([
|
|
|
104
108
|
|
|
105
109
|
const isLastElementObjectExpression = ({node}) => isObjectExpression(node.elements.at(-1));
|
|
106
110
|
|
|
107
|
-
const isNeedsNewlineOption = (a, {needsNewline}) => needsNewline;
|
|
108
|
-
const isNeedsToHideIndentOption = (a, {needsToHideIndent}) => needsToHideIndent;
|
|
109
|
-
|
|
110
111
|
export const isSecondIndent = createTypeChecker([
|
|
111
112
|
['-: -> !', isNeedsNewlineOption],
|
|
112
113
|
['+', isNeedsToHideIndentOption],
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
isSimpleAndNotEmptyObject,
|
|
12
12
|
isInsideCall,
|
|
13
13
|
isInsideArray,
|
|
14
|
-
|
|
14
|
+
callWithNext,
|
|
15
15
|
} from '#is';
|
|
16
16
|
import {isIncreaseIndent} from './indent.js';
|
|
17
17
|
|
|
@@ -312,6 +312,6 @@ export const isCurrentNewLine = createTypeChecker([
|
|
|
312
312
|
]);
|
|
313
313
|
|
|
314
314
|
export const isNewlineAfterComma = createTypeChecker([
|
|
315
|
-
['-',
|
|
316
|
-
['+: -> !'
|
|
315
|
+
['-', callWithNext(isObjectExpression)],
|
|
316
|
+
['+: -> !ObjectExpression'],
|
|
317
317
|
]);
|
package/package.json
CHANGED