@putout/printer 18.1.2 → 18.1.4

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
+ 2026.03.06, v18.1.4
2
+
3
+ fix:
4
+ - 27872ca @putout/printer: ArrayExpression: newline: string and object
5
+
6
+ 2026.03.06, v18.1.3
7
+
8
+ fix:
9
+ - 033b2a6 @putout/printer: ArrayExpression: maxElementLengthInOneLine
10
+
1
11
  2026.03.06, v18.1.2
2
12
 
3
13
  feature:
@@ -151,15 +151,26 @@ const isMoreThenMaxLiteralLength = (path, {maxElementLengthInOneLine}) => {
151
151
  return first.value.length > maxElementLengthInOneLine;
152
152
  };
153
153
 
154
- const isMoreThenMaxIdentifierLength = (path) => {
154
+ const isMoreThenMaxIdentifierLength = (path, {maxElementLengthInOneLine}) => {
155
155
  const [first] = path.node.elements;
156
156
 
157
- return isIdentifier(first);
157
+ if (!isIdentifier(first))
158
+ return false;
159
+
160
+ return first.name.length > maxElementLengthInOneLine;
161
+ };
162
+
163
+ const hasObjects = (path) => {
164
+ const {elements} = path.node;
165
+ const literals = elements.filter(isObjectExpression);
166
+
167
+ return literals.length;
158
168
  };
159
169
 
160
170
  const isMoreThenMaxElementLengthInOneLine = createTypeChecker([
161
171
  ['-', isEmptyArray],
162
172
  ['-: -> !', isInsideCall],
173
+ ['-', hasObjects],
163
174
  ['+', isMoreThenMaxLiteralLength],
164
175
  ['+', isMoreThenMaxIdentifierLength],
165
176
  ]);
@@ -1,7 +1,7 @@
1
1
  import {createTuple} from './create-tuple.js';
2
2
 
3
- const {isArray} = Array;
4
3
  const isString = (a) => typeof a === 'string';
4
+ const {isArray} = Array;
5
5
 
6
6
  export const parseOperation = (operation) => {
7
7
  const [result, command] = operation.split(':');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "18.1.2",
3
+ "version": "18.1.4",
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",