@putout/printer 14.3.0 → 14.3.2

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,13 @@
1
+ 2025.03.28, v14.3.2
2
+
3
+ feature:
4
+ - 9319338 @putout/printer: ArrayExpression: nested triple
5
+
6
+ 2025.03.28, v14.3.1
7
+
8
+ feature:
9
+ - 8ea46f3 @putout/printer: ExpressionStatement: after CallExpression: indent
10
+
1
11
  2025.03.28, v14.3.0
2
12
 
3
13
  feature:
@@ -31,12 +31,14 @@ function isArrayInsideArray(path) {
31
31
 
32
32
  const parentElements = path.parentPath.node.elements;
33
33
  const parentHasArrays = parentElements.filter(isArrayExpression).length;
34
- const lastIsArray = !isArrayExpression(parentElements.at(-1));
34
+ const lastNotArray = !isArrayExpression(parentElements.at(-1));
35
35
 
36
- if (parentHasArrays && lastIsArray)
36
+ if (parentHasArrays && lastNotArray)
37
37
  return false;
38
38
 
39
- return parentElements.length <= 3;
39
+ const {length} = parentElements;
40
+
41
+ return length <= 3 && length !== 1;
40
42
  }
41
43
 
42
44
  const isTwoLongStrings = ([a, b]) => {
@@ -64,7 +64,7 @@ module.exports.ExpressionStatement = {
64
64
  before(path, {indent}) {
65
65
  indent();
66
66
  },
67
- print(path, {print, maybe, store}) {
67
+ print(path, {print, maybe, store, indent}) {
68
68
  const insideReturn = isInsideReturn(path);
69
69
 
70
70
  print('__expression');
@@ -75,7 +75,15 @@ module.exports.ExpressionStatement = {
75
75
 
76
76
  if (!insideReturn && shouldBreakline(path)) {
77
77
  print.newline();
78
- maybe.indent(isNext(path) && noTrailingComment(path) || isNextCallWithLeadingComment(path));
78
+
79
+ const condition = isNext(path)
80
+ && noTrailingComment(path)
81
+ || isNextCallWithLeadingComment(path)
82
+ || isNextIf(path);
83
+
84
+ if (condition)
85
+ indent();
86
+
79
87
  store(true);
80
88
  }
81
89
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "14.3.0",
3
+ "version": "14.3.2",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Simplest possible opinionated Babel AST printer for 🐊Putout",