@putout/printer 2.28.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,13 @@
1
+ 2023.06.19, v2.30.0
2
+
3
+ feature:
4
+ - 91710cd @putout/printer: ArrayExpression: newline
5
+
6
+ 2023.06.19, v2.29.0
7
+
8
+ feature:
9
+ - feb7c6a @putout/printer: ArrayExpression: String/String: tuple
10
+
1
11
  2023.06.19, v2.28.0
2
12
 
3
13
  feature:
@@ -84,6 +84,9 @@ module.exports.isNewlineBetweenElements = (path, {elements, maxElementsInOneLine
84
84
  if (isTwoStringsDifferentLength(elements))
85
85
  return ONE_LINE;
86
86
 
87
+ if (isTwoSimplesInsideObjectProperty(path))
88
+ return ONE_LINE;
89
+
87
90
  if (isStringAndArray(elements))
88
91
  return ONE_LINE;
89
92
 
@@ -128,6 +131,25 @@ const isShortTwoSimplesInsideCall = (path, short) => {
128
131
  return length < short;
129
132
  };
130
133
 
134
+ const isTwoSimplesInsideObjectProperty = (path) => {
135
+ const {node, parentPath} = path;
136
+
137
+ const {elements} = node;
138
+ const {length} = elements;
139
+ const [a, b] = elements;
140
+
141
+ if (length > 2)
142
+ return false;
143
+
144
+ if (!parentPath.isObjectProperty())
145
+ return false;
146
+
147
+ if (!isStringLiteral(a) || !isStringLiteral(b))
148
+ return false;
149
+
150
+ return !isCoupleLines(path);
151
+ };
152
+
131
153
  function isOneSimple(path) {
132
154
  const elements = path.get('elements');
133
155
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "2.28.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",