@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
|
@@ -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