@putout/printer 2.29.0 → 2.30.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,8 @@
1
+ 2023.06.19, v2.30.0
2
+
3
+ feature:
4
+ - 91710cd @putout/printer: ArrayExpression: newline
5
+
1
6
  2023.06.19, v2.29.0
2
7
 
3
8
  feature:
@@ -84,7 +84,7 @@ module.exports.isNewlineBetweenElements = (path, {elements, maxElementsInOneLine
84
84
  if (isTwoStringsDifferentLength(elements))
85
85
  return ONE_LINE;
86
86
 
87
- if (isShortTwoSimplesInsideObjectProperty(path, maxElementsInOneLine))
87
+ if (isTwoSimplesInsideObjectProperty(path))
88
88
  return ONE_LINE;
89
89
 
90
90
  if (isStringAndArray(elements))
@@ -131,7 +131,7 @@ const isShortTwoSimplesInsideCall = (path, short) => {
131
131
  return length < short;
132
132
  };
133
133
 
134
- const isShortTwoSimplesInsideObjectProperty = (path, short) => {
134
+ const isTwoSimplesInsideObjectProperty = (path) => {
135
135
  const {node, parentPath} = path;
136
136
 
137
137
  const {elements} = node;
@@ -147,14 +147,9 @@ const isShortTwoSimplesInsideObjectProperty = (path, short) => {
147
147
  if (!isStringLiteral(a) || !isStringLiteral(b))
148
148
  return false;
149
149
 
150
- if (looksLikeTuple(a, b))
151
- return false;
152
-
153
- return length < short;
150
+ return !isCoupleLines(path);
154
151
  };
155
152
 
156
- const looksLikeTuple = (a, b) => b.value.length + 5 <= a.value.length * 2;
157
-
158
153
  function isOneSimple(path) {
159
154
  const elements = path.get('elements');
160
155
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "2.29.0",
3
+ "version": "2.30.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",