@putout/printer 18.0.16 → 18.1.0

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,19 @@
1
+ 2026.03.06, v18.1.0
2
+
3
+ feature:
4
+ - 604e849 @putout/printer: ArrayExpression: long identifier: improve support
5
+ - bdd07e7 @putout/printer: isMultiLine: siplify
6
+ - 945a833 @putout/printer: ArrayExpression: newline: isCoupleLines
7
+ - 2ca2751 @putout/printer: ArrayExpression: newline: isStringsInsideArray
8
+ - 488eb71 @putout/printer: ArrayExpression: newline: isSimpleAndObject
9
+ - 246f9df @putout/printer: ArrayExpression: newline: isIdentifierAndString
10
+ - 56637d1 @putout/printer: ArrayExpression: newline: isStringAndIdentifier
11
+ - caa4682 @putout/printer: ArrayExpression: newline: isStringAndIdentifier
12
+ - 0e9dc1d @putout/printer: ArrayExpression: newline: isMultiline: simplify
13
+ - 103ad2e @putout/printer: ExpressionStatement: isBreakline
14
+ - 04c19c3 @putout/printer: ExpressionStatement: isNextToAssignmentCall: simplify
15
+ - 4bcbd61 @putout/printer: ExpressionStatement: isNextStatementWithBlockComment: simplify
16
+
1
17
  2026.03.06, v18.0.16
2
18
 
3
19
  feature:
@@ -77,7 +77,6 @@ const isInsideOneElementArray = ({parentPath}) => parentPath.node.elements.lengt
77
77
  export const ArrayExpression = {
78
78
  beforeIf(path) {
79
79
  const {parentPath} = path;
80
- const {elements} = path.node;
81
80
 
82
81
  if (!parentPath.isArrayExpression())
83
82
  return false;
@@ -85,10 +84,10 @@ export const ArrayExpression = {
85
84
  if (isCoupleLines(parentPath))
86
85
  return false;
87
86
 
88
- if (isStringAndIdentifier(elements) && isInsideOneElementArray(path))
87
+ if (isStringAndIdentifier(path) && isInsideOneElementArray(path))
89
88
  return true;
90
89
 
91
- return isIdentifierAndIdentifier(elements);
90
+ return isIdentifierAndIdentifier(path);
92
91
  },
93
92
  before(path, {print}) {
94
93
  print.breakline();
@@ -110,7 +109,6 @@ export const ArrayExpression = {
110
109
  maybe.indent.inc(indented && shouldIncreaseIndent);
111
110
 
112
111
  const isNewLine = isMultiLine(path, {
113
- elements,
114
112
  maxElementsInOneLine,
115
113
  maxElementLengthInOneLine,
116
114
  });
@@ -148,7 +146,7 @@ export const ArrayExpression = {
148
146
 
149
147
  const parentElements = path.parentPath.get('elements');
150
148
 
151
- if (isInsideArray(path) && isStringAndArray(parentElements)) {
149
+ if (isInsideArray(path) && isStringAndArray(path.parentPath)) {
152
150
  const parentCountTwo = parentElements.length === 2;
153
151
  const isHideIdent = !isAroundStrings(path) || parentCountTwo;
154
152
 
@@ -159,7 +157,7 @@ export const ArrayExpression = {
159
157
  maybe.indent(elements.length && isNewLine);
160
158
  }
161
159
 
162
- if (isSimpleAndNotEmptyObject(elements) && !isSpreadElement(elements.at(-1)) && !isCallExpression(elements.at(-1))) {
160
+ if (isSimpleAndNotEmptyObject(path) && !isSpreadElement(elements.at(-1)) && !isCallExpression(elements.at(-1))) {
163
161
  print(',');
164
162
  print.breakline();
165
163
  }
@@ -168,7 +166,6 @@ export const ArrayExpression = {
168
166
  },
169
167
  afterIf(path) {
170
168
  const {parentPath} = path;
171
- const {elements} = path.node;
172
169
 
173
170
  if (!parentPath.isArrayExpression())
174
171
  return false;
@@ -176,10 +173,10 @@ export const ArrayExpression = {
176
173
  if (isCoupleLines(parentPath))
177
174
  return false;
178
175
 
179
- if (isStringAndIdentifier(elements) && isInsideOneElementArray(path))
176
+ if (isStringAndIdentifier(path) && isInsideOneElementArray(path))
180
177
  return true;
181
178
 
182
- return isIdentifierAndIdentifier(elements);
179
+ return isIdentifierAndIdentifier(path);
183
180
  },
184
181
  after(path, {print, indent}) {
185
182
  indent.dec();
@@ -11,10 +11,69 @@ import {
11
11
  isSimpleAndNotEmptyObject,
12
12
  isInsideCall,
13
13
  } from '#is';
14
+ import {isInsideArray} from './indent.js';
15
+ import {isInsideForOf} from '../object-pattern/is.js';
16
+
17
+ const isLastArg = ({parentPath}) => !parentPath.isCallExpression();
18
+ const isParentProperty = (path) => path.find(isObjectProperty);
19
+
20
+ const isNumbersArray = createTypeChecker([
21
+ ['-: node.elements', isNumbers],
22
+ ['-', isInsideForOf],
23
+ ['-: -> !', isLastArg],
24
+ ['+: -> !', isParentProperty],
25
+ ]);
26
+
27
+ const isStringAndString = (path) => {
28
+ const {elements} = path.node;
29
+ const [a, b] = elements;
30
+
31
+ return isStringLiteral(a) && isStringLiteral(b);
32
+ };
33
+
34
+ const isStringsInsideArray = createTypeChecker([
35
+ ['-: -> !', isStringAndString],
36
+ ['-: -> !', isInsideArray],
37
+ '+: parentPath.node.elements.0 -> ArrayExpression',
38
+ ]);
39
+
40
+ const isTwoSimplesInsideObjectProperty = (path) => {
41
+ const {node, parentPath} = path;
42
+
43
+ const {elements} = node;
44
+ const {length} = elements;
45
+ const [a, b] = elements;
46
+
47
+ if (length > 2)
48
+ return false;
49
+
50
+ if (!parentPath.isObjectProperty())
51
+ return false;
52
+
53
+ if (!isStringLiteral(a) || !isStringLiteral(b))
54
+ return false;
55
+
56
+ return !isCoupleLines(path);
57
+ };
58
+
59
+ const isShortTwoSimplesInsideCall = (path, {maxElementsInOneLine}) => {
60
+ const {node, parentPath} = path;
61
+
62
+ const {elements} = node;
63
+ const {length} = elements;
64
+ const [a, b] = elements;
65
+
66
+ if (!parentPath.isCallExpression())
67
+ return false;
68
+
69
+ if (!isStringLiteral(a) || !isStringLiteral(b))
70
+ return false;
71
+
72
+ return length < maxElementsInOneLine;
73
+ };
14
74
 
15
75
  const {
16
76
  isObjectExpression,
17
- isArrayExpression,
18
77
  isObjectProperty,
19
78
  isCallExpression,
20
79
  isAwaitExpression,
@@ -23,11 +82,14 @@ const {
23
82
  isStringLiteral,
24
83
  isSpreadElement,
25
84
  isIdentifier,
85
+ isNumericLiteral,
26
86
  } = types;
27
87
 
28
88
  const {round} = Math;
29
89
 
30
- const isOneSpread = (elements) => {
90
+ const isOneSpread = (path) => {
91
+ const {elements} = path.node;
92
+
31
93
  if (elements.length > 1)
32
94
  return false;
33
95
 
@@ -36,19 +98,38 @@ const isOneSpread = (elements) => {
36
98
  return isSpreadElement(first);
37
99
  };
38
100
 
39
- const isSimpleAndCall = ([a, b]) => {
101
+ const isSimpleAndCall = (path) => {
102
+ const {elements} = path.node;
103
+ const [a, b] = elements;
104
+
40
105
  if (!isSimple(a))
41
106
  return;
42
107
 
43
108
  return isCallExpression(b) || isAwaitExpression(b);
44
109
  };
45
110
 
46
- const isBooleanAndSimple = ([a, b]) => isBooleanLiteral(a) && isSimple(b);
111
+ const isBooleanAndSimple = (path) => {
112
+ const {elements} = path.node;
113
+ const [a, b] = elements;
114
+
115
+ return isBooleanLiteral(a) && isSimple(b);
116
+ };
117
+
47
118
  const isBooleanAndObject = ([a, b]) => isBooleanLiteral(a) && isObjectExpression(b);
48
- const isNullAndSimple = ([a, b]) => isNullLiteral(a) && isSimple(b);
49
- const isSimpleAndObject = ([a, b]) => isSimple(a) && isObjectExpression(b);
50
- const ONE_LINE = false;
51
- const MULTI_LINE = true;
119
+
120
+ const isNullAndSimple = (path) => {
121
+ const {elements} = path.node;
122
+ const [a, b] = elements;
123
+
124
+ return isNullLiteral(a) && isSimple(b);
125
+ };
126
+
127
+ const isSimpleAndObject = (path) => {
128
+ const {elements} = path.node;
129
+ const [a, b] = elements;
130
+
131
+ return isSimple(a) && isObjectExpression(b);
132
+ };
52
133
 
53
134
  const isSiblingIsArray = (path) => {
54
135
  if (path.getNextSibling().isArrayExpression())
@@ -70,13 +151,22 @@ const isMoreThenMaxLiteralLength = (path, {maxElementLengthInOneLine}) => {
70
151
  return first.value.length > maxElementLengthInOneLine;
71
152
  };
72
153
 
154
+ const isMoreThenMaxIdentifierLength = (path) => {
155
+ const [first] = path.node.elements;
156
+
157
+ return isIdentifier(first);
158
+ };
159
+
73
160
  const isMoreThenMaxElementLengthInOneLine = createTypeChecker([
74
161
  ['-', isEmptyArray],
75
162
  ['-: -> !', isInsideCall],
76
163
  ['+', isMoreThenMaxLiteralLength],
164
+ ['+', isMoreThenMaxIdentifierLength],
77
165
  ]);
78
166
 
79
- function isMaxElementLengthInOneLine(elements, maxElementLengthInOneLine) {
167
+ function isMaxElementLengthInOneLine(path, {maxElementLengthInOneLine}) {
168
+ const elements = path.get('elements');
169
+
80
170
  if (elements.length > 1)
81
171
  return false;
82
172
 
@@ -88,125 +178,55 @@ function isMaxElementLengthInOneLine(elements, maxElementLengthInOneLine) {
88
178
  return first.node.name.length < maxElementLengthInOneLine;
89
179
  }
90
180
 
91
- export const isMultiLine = (path, {elements, maxElementsInOneLine, maxElementLengthInOneLine}) => {
92
- const [first] = elements;
93
-
94
- if (isMaxElementLengthInOneLine(elements, maxElementLengthInOneLine))
95
- return ONE_LINE;
96
-
97
- if (isMoreThenMaxElementLengthInOneLine(path, {elements, maxElementLengthInOneLine}))
98
- return MULTI_LINE;
99
-
100
- if (elements.length > maxElementsInOneLine && isStringLiteral(first))
101
- return MULTI_LINE;
102
-
103
- if (elements.length > 3 && !isObjectExpression(first))
104
- return MULTI_LINE;
105
-
106
- if (isSimpleAndNotEmptyObject(elements))
107
- return MULTI_LINE;
108
-
109
- if (isOneSimple(path))
110
- return ONE_LINE;
111
-
112
- if (isOneSpread(elements))
113
- return ONE_LINE;
114
-
115
- if (elements.length === 2 && isIdentifierAndIdentifier(elements))
116
- return ONE_LINE;
117
-
118
- if (isCallInsideArrow(path))
119
- return ONE_LINE;
120
-
121
- if (isIncreaseIndent(path))
122
- return ONE_LINE;
123
-
124
- if (isInsideLoop(path))
125
- return ONE_LINE;
126
-
127
- if (isBooleanAndSimple(elements))
128
- return ONE_LINE;
129
-
130
- if (isNullAndSimple(elements))
131
- return ONE_LINE;
132
-
133
- if (isSimpleAndCall(elements))
134
- return ONE_LINE;
135
-
136
- if (isShortTwoSimplesInsideCall(path, maxElementsInOneLine))
137
- return ONE_LINE;
138
-
139
- if (isTwoStringsDifferentLength(elements))
140
- return ONE_LINE;
141
-
142
- if (isTwoSimplesInsideObjectProperty(path))
143
- return ONE_LINE;
144
-
145
- if (isStringAndArray(elements) && elements.length < 3)
146
- return ONE_LINE;
147
-
148
- if (isStringAndMember(elements))
149
- return ONE_LINE;
150
-
151
- if (isStringAndIdentifier(elements))
152
- return ONE_LINE;
153
-
154
- if (isIdentifierAndString(elements))
155
- return ONE_LINE;
156
-
157
- if (isSimpleAndObject(elements))
158
- return ONE_LINE;
159
-
160
- if (isStringAndString(elements) && path.parentPath.isArrayExpression() && isArrayExpression(path.parentPath.node.elements[0]))
161
- return ONE_LINE;
162
-
163
- if (isSiblingIsArray(path))
164
- return ONE_LINE;
165
-
166
- if (tooLong(path) || isCoupleLines(path) || !isNumbers(elements) && !isForOf(path) && isLastArg(path) && !isParentProperty(path))
167
- return MULTI_LINE;
168
-
169
- return ONE_LINE;
181
+ const isElementsMoreThenMax = (path, {maxElementsInOneLine}) => {
182
+ const {elements} = path.node;
183
+ return elements.length > maxElementsInOneLine;
170
184
  };
171
185
 
172
- const isForOf = ({parentPath}) => parentPath.isForOfStatement();
186
+ const isElementsMoreThenThree = (path) => {
187
+ const {elements} = path.node;
188
+ return elements.length > 3;
189
+ };
173
190
 
174
- const isStringAndString = ([a, b]) => isStringLiteral(a) && isStringLiteral(b);
191
+ const isElementsMoreThenThreeWithNotFirstObject = createTypeChecker([
192
+ '-: node.elements.0 -> ObjectExpression',
193
+ isElementsMoreThenThree,
194
+ ]);
175
195
 
176
- const isShortTwoSimplesInsideCall = (path, maxElementsInOneLine) => {
177
- const {node, parentPath} = path;
178
-
179
- const {elements} = node;
180
- const {length} = elements;
181
- const [a, b] = elements;
182
-
183
- if (!parentPath.isCallExpression())
184
- return false;
185
-
186
- if (!isStringLiteral(a) || !isStringLiteral(b))
187
- return false;
188
-
189
- return length < maxElementsInOneLine;
190
- };
196
+ const isElementsMoreThenMaxWithFirstString = createTypeChecker([
197
+ '-: node.elements.0 -> !StringLiteral',
198
+ isElementsMoreThenMax,
199
+ ]);
191
200
 
192
- const isTwoSimplesInsideObjectProperty = (path) => {
193
- const {node, parentPath} = path;
194
-
195
- const {elements} = node;
196
- const {length} = elements;
197
- const [a, b] = elements;
198
-
199
- if (length > 2)
200
- return false;
201
-
202
- if (!parentPath.isObjectProperty())
203
- return false;
204
-
205
- if (!isStringLiteral(a) || !isStringLiteral(b))
206
- return false;
207
-
208
- return !isCoupleLines(path);
209
- };
201
+ export const isMultiLine = createTypeChecker([
202
+ ['-', isMaxElementLengthInOneLine],
203
+ isMoreThenMaxElementLengthInOneLine,
204
+ isElementsMoreThenMaxWithFirstString,
205
+ isElementsMoreThenThreeWithNotFirstObject,
206
+ isSimpleAndNotEmptyObject,
207
+ ['-', isOneSimple],
208
+ ['-', isOneSpread],
209
+ ['-', isIdentifierAndIdentifier],
210
+ ['-', isCallInsideArrow],
211
+ ['-', isIncreaseIndent],
212
+ ['-', isInsideLoop],
213
+ ['-', isBooleanAndSimple],
214
+ ['-', isNullAndSimple],
215
+ ['-', isSimpleAndCall],
216
+ ['-', isShortTwoSimplesInsideCall],
217
+ ['-', isTwoStringsDifferentLength],
218
+ ['-', isTwoSimplesInsideObjectProperty],
219
+ ['-', isStringAndArray],
220
+ ['-', isStringAndMember],
221
+ ['-', isStringAndIdentifier],
222
+ ['-', isIdentifierAndString],
223
+ ['-', isSimpleAndObject],
224
+ ['-', isSiblingIsArray],
225
+ ['-', isStringsInsideArray],
226
+ tooLong,
227
+ isCoupleLines,
228
+ isNumbersArray,
229
+ ]);
210
230
 
211
231
  function isOneSimple(path) {
212
232
  const elements = path.get('elements');
@@ -228,17 +248,18 @@ function isOneSimple(path) {
228
248
  return first.isMemberExpression();
229
249
  }
230
250
 
231
- function isTwoStringsDifferentLength(strings) {
232
- const [a, b] = strings;
251
+ function isTwoStringsDifferentLength(path) {
252
+ const {elements} = path.node;
253
+ const [a, b] = elements;
233
254
 
234
- if (strings.length > 2)
255
+ if (elements.length > 2)
235
256
  return false;
236
257
 
237
- if (!a?.isStringLiteral() || !b?.isStringLiteral())
258
+ if (!isStringLiteral(a) || !isStringLiteral(b))
238
259
  return false;
239
260
 
240
- const aLength = a.node.value.length;
241
- const bLength = b.node.value.length;
261
+ const aLength = a.value.length;
262
+ const bLength = b.value.length;
242
263
 
243
264
  return round(bLength / aLength) > 2;
244
265
  }
@@ -275,17 +296,13 @@ function isCallInsideArrow(path) {
275
296
 
276
297
  function isNumbers(elements) {
277
298
  for (const element of elements) {
278
- if (element.isNumericLiteral())
299
+ if (isNumericLiteral(element))
279
300
  return true;
280
301
  }
281
302
 
282
303
  return false;
283
304
  }
284
305
 
285
- const isLastArg = ({parentPath}) => !parentPath.isCallExpression();
286
-
287
- const isParentProperty = (path) => path.find(isObjectProperty);
288
-
289
306
  export function isIncreaseIndent(path) {
290
307
  const elements = path.get('elements');
291
308
 
@@ -91,7 +91,10 @@ export function isCoupleLines(path) {
91
91
 
92
92
  export const exists = (a) => a.node;
93
93
 
94
- export function isStringAndIdentifier([a, b]) {
94
+ export function isStringAndIdentifier(path) {
95
+ const {elements} = path.node;
96
+ const [a, b] = elements;
97
+
95
98
  return isStringLiteral(a) && isIdentifier(b);
96
99
  }
97
100
 
@@ -107,7 +110,8 @@ const checkObject = (elements) => {
107
110
  return a.node.properties.length;
108
111
  };
109
112
 
110
- export const isSimpleAndNotEmptyObject = (elements) => {
113
+ export const isSimpleAndNotEmptyObject = (path) => {
114
+ const elements = path.get('elements');
111
115
  const [a] = elements;
112
116
 
113
117
  const simpleTypes = [
@@ -124,20 +128,44 @@ export const isSimpleAndNotEmptyObject = (elements) => {
124
128
  return checkObject(elements);
125
129
  };
126
130
 
127
- export const isIdentifierAndIdentifier = ([a, b]) => {
131
+ export const isIdentifierAndIdentifier = (path) => {
132
+ const {elements} = path.node;
133
+
134
+ if (elements.length !== 2)
135
+ return;
136
+
137
+ const [a, b] = elements;
138
+
128
139
  return isIdentifier(a) && isIdentifier(b);
129
140
  };
130
141
 
131
- export const isStringAndMember = ([a, b]) => isStringLiteral(a) && isMemberExpression(b);
132
- export const isIdentifierAndString = ([a, b]) => isIdentifier(a) && isStringLiteral(b);
133
- export const isStringAndArray = ([a, b]) => {
142
+ export const isStringAndMember = (path) => {
143
+ const {elements} = path.node;
144
+ const [a, b] = elements;
145
+
146
+ return isStringLiteral(a) && isMemberExpression(b);
147
+ };
148
+ export const isIdentifierAndString = (path) => {
149
+ const {elements} = path.node;
150
+ const [a, b] = elements;
151
+
152
+ return isIdentifier(a) && isStringLiteral(b);
153
+ };
154
+ export const isStringAndArray = (path) => {
155
+ const elements = path.get('elements');
156
+
157
+ if (elements.length !== 2)
158
+ return false;
159
+
160
+ const [a, b] = elements;
161
+
134
162
  if (!isStringLiteral(a))
135
163
  return false;
136
164
 
137
165
  if (!isArrayExpression(b))
138
166
  return false;
139
167
 
140
- return !isStringAndIdentifier(b.node.elements);
168
+ return !isStringAndIdentifier(b);
141
169
  };
142
170
 
143
171
  const isIfOrStatement = (a) => isIfStatement(a) || isStatement(a);
@@ -1,10 +1,8 @@
1
- import {types} from '@putout/babel';
2
1
  import {createTypeChecker} from '#type-checker';
3
2
  import {
4
3
  isNext,
5
4
  isLast,
6
5
  isNewlineBetweenSiblings,
7
- satisfy,
8
6
  noTrailingComment,
9
7
  hasTrailingComment,
10
8
  isCoupleLines,
@@ -19,28 +17,33 @@ import {
19
17
  import {afterIf} from './after-if.js';
20
18
  import {beforeIf} from './before-if.js';
21
19
 
22
- const isCommentBlock = (a) => a?.type === 'CommentBlock';
23
- const isBreakline = createTypeChecker([
20
+ const isCallInsideExpression = createTypeChecker([
21
+ '-: -> !ExpressionStatement',
22
+ '+: node.expression -> CallExpression',
23
+ ]);
24
+
25
+ const isNextToAssignmentCall = createTypeChecker([
26
+ '-: node.expression -> AssignmentExpression',
27
+ ['+', getNext(isCallInsideExpression)],
28
+ ]);
29
+
30
+ const isNextStatementWithBlockComment = createTypeChecker([
31
+ '-: node.expression -> !CallExpression',
32
+ '-: node.expression.arguments.0 -> !CallExpression',
33
+ '+: node.trailingComments.0 -> CommentBlock',
34
+ ]);
35
+
36
+ const isBreaklineAfter = createTypeChecker([
24
37
  ['-: -> !', hasTrailingComment],
25
38
  ['-: -> !', isLast],
26
39
  ['+', isCoupleLines],
27
40
  ]);
28
41
 
29
- const {
30
- isCallExpression,
31
- isExpressionStatement,
32
- isAssignmentExpression,
33
- } = types;
34
-
35
42
  const isNextIf = (path) => path
36
43
  .getNextSibling()
37
44
  .isIfStatement();
38
45
 
39
- const shouldBreakline = satisfy([
40
- isNewlineBetweenSiblings,
41
- isNotLastBody,
42
- isNextIf,
43
- ]);
46
+ const isBreakline = createTypeChecker([isNewlineBetweenSiblings, isNextIf]);
44
47
 
45
48
  const isIndent = createTypeChecker([
46
49
  noTrailingComment,
@@ -67,7 +70,7 @@ export const ExpressionStatement = {
67
70
  if (!isNext(path))
68
71
  return;
69
72
 
70
- if (!insideReturn && shouldBreakline(path)) {
73
+ if (isBreakline(path)) {
71
74
  print.newline();
72
75
  maybe.indent(isIndent(path));
73
76
  store(true);
@@ -75,7 +78,7 @@ export const ExpressionStatement = {
75
78
  },
76
79
  afterIf,
77
80
  after(path, {print, maybe, store}) {
78
- maybe.print.breakline(isBreakline(path));
81
+ maybe.print.breakline(isBreaklineAfter(path));
79
82
 
80
83
  if (isInsideReturn(path))
81
84
  return;
@@ -87,40 +90,3 @@ export const ExpressionStatement = {
87
90
  };
88
91
  ExpressionStatement.printLeadingCommentLine = printLeadingCommentLine;
89
92
  ExpressionStatement.printLeadingCommentBlock = printLeadingCommentBlock;
90
-
91
- function isNotLastBody(path) {
92
- return path.parentPath.get('body') === path;
93
- }
94
-
95
- function isNextToAssignmentCall(path) {
96
- if (isAssignmentExpression(path.node.expression))
97
- return false;
98
-
99
- const nextPath = path.getNextSibling();
100
-
101
- if (!isExpressionStatement(nextPath))
102
- return false;
103
-
104
- const {expression} = nextPath.node;
105
-
106
- return isCallExpression(expression);
107
- }
108
-
109
- function isNextStatementWithBlockComment(path) {
110
- const {expression} = path.node;
111
-
112
- if (!isCallExpression(expression))
113
- return false;
114
-
115
- if (!isCallExpression(expression.arguments[0]))
116
- return false;
117
-
118
- return hasTrailingBlock(path);
119
- }
120
-
121
- function hasTrailingBlock(path) {
122
- const {trailingComments} = path.node;
123
- const [first] = trailingComments;
124
-
125
- return isCommentBlock(first);
126
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "18.0.16",
3
+ "version": "18.1.0",
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",