@putout/printer 1.131.0 → 1.133.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,13 @@
1
+ 2023.06.05, v1.133.0
2
+
3
+ feature:
4
+ - 2f33c34 @putout/printer: ObjectExpression inside ArrayExpression
5
+
6
+ 2023.06.04, v1.132.0
7
+
8
+ feature:
9
+ - b83ad0c @putout/printer: ArrayExpression: Tuple
10
+
1
11
  2023.06.03, v1.131.0
2
12
 
3
13
  feature:
@@ -8,6 +8,9 @@ const {
8
8
  isArrayExpression,
9
9
  isIdentifier,
10
10
  isCallExpression,
11
+ isBooleanLiteral,
12
+ isObjectExpression,
13
+
11
14
  } = require('@babel/types');
12
15
 
13
16
  const {isSimple} = require('@putout/operate');
@@ -24,6 +27,7 @@ const isStringAndString = ([a, b]) => isStringLiteral(a) && isStringLiteral(b);
24
27
  const isIdentifierAndIdentifier = ([a, b]) => isIdentifier(a) && isIdentifier(b);
25
28
  const isInsideArray = (path) => path.parentPath.isArrayExpression();
26
29
  const isSimpleAndCall = ([a, b]) => isSimple(a) && isCallExpression(b);
30
+ const isBooleanAndSimple = ([a, b]) => isBooleanLiteral(a) && isSimple(b);
27
31
 
28
32
  const isTwoLongStrings = ([a, b]) => {
29
33
  const LONG_STRING = 20;
@@ -209,7 +213,7 @@ function isOneSimple(path) {
209
213
  }
210
214
 
211
215
  function isNewlineBetweenElements(path, {elements}) {
212
- if (elements.length > 3)
216
+ if (elements.length > 3 && !isObjectExpression(elements[0]))
213
217
  return true;
214
218
 
215
219
  if (isOneSimple(path))
@@ -230,6 +234,9 @@ function isNewlineBetweenElements(path, {elements}) {
230
234
  if (isInsideLoop(path))
231
235
  return false;
232
236
 
237
+ if (isBooleanAndSimple(elements))
238
+ return false;
239
+
233
240
  if (isSimpleAndCall(elements))
234
241
  return false;
235
242
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "1.131.0",
3
+ "version": "1.133.0",
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",