@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 CHANGED
@@ -1,3 +1,8 @@
1
+ 2026.03.08, v18.2.12
2
+
3
+ feature:
4
+ - 284d9a7 @putout/printer: ArrayExpression: isNewlineAfterComma: simplify
5
+
1
6
  2026.03.08, v18.2.11
2
7
 
3
8
  feature:
@@ -86,7 +86,7 @@ export const ArrayExpression = {
86
86
  if (index < n || trailingComma)
87
87
  maybe.print(is, ',');
88
88
 
89
- if (is && isNewlineAfterComma(element))
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],
@@ -0,0 +1,3 @@
1
+ export const isNeedsNewlineOption = (a, {needsNewline}) => needsNewline;
2
+
3
+ export const isNeedsToHideIndentOption = (a, {needsToHideIndent}) => needsToHideIndent;
@@ -11,7 +11,7 @@ import {
11
11
  isSimpleAndNotEmptyObject,
12
12
  isInsideCall,
13
13
  isInsideArray,
14
- isNextObject,
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
- ['-', isNextObject],
316
- ['+: -> !', isObjectExpression],
315
+ ['-', callWithNext(isObjectExpression)],
316
+ ['+: -> !ObjectExpression'],
317
317
  ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "18.2.11",
3
+ "version": "18.2.12",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Simplest possible opinionated Babel AST printer for 🐊Putout",