@putout/printer 18.1.2 → 18.1.4
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
|
@@ -151,15 +151,26 @@ const isMoreThenMaxLiteralLength = (path, {maxElementLengthInOneLine}) => {
|
|
|
151
151
|
return first.value.length > maxElementLengthInOneLine;
|
|
152
152
|
};
|
|
153
153
|
|
|
154
|
-
const isMoreThenMaxIdentifierLength = (path) => {
|
|
154
|
+
const isMoreThenMaxIdentifierLength = (path, {maxElementLengthInOneLine}) => {
|
|
155
155
|
const [first] = path.node.elements;
|
|
156
156
|
|
|
157
|
-
|
|
157
|
+
if (!isIdentifier(first))
|
|
158
|
+
return false;
|
|
159
|
+
|
|
160
|
+
return first.name.length > maxElementLengthInOneLine;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
const hasObjects = (path) => {
|
|
164
|
+
const {elements} = path.node;
|
|
165
|
+
const literals = elements.filter(isObjectExpression);
|
|
166
|
+
|
|
167
|
+
return literals.length;
|
|
158
168
|
};
|
|
159
169
|
|
|
160
170
|
const isMoreThenMaxElementLengthInOneLine = createTypeChecker([
|
|
161
171
|
['-', isEmptyArray],
|
|
162
172
|
['-: -> !', isInsideCall],
|
|
173
|
+
['-', hasObjects],
|
|
163
174
|
['+', isMoreThenMaxLiteralLength],
|
|
164
175
|
['+', isMoreThenMaxIdentifierLength],
|
|
165
176
|
]);
|
package/package.json
CHANGED