@putout/printer
Advanced tools
Comparing version 8.17.0 to 8.18.0
@@ -39,2 +39,12 @@ 'use strict'; | ||
const isObjectAfterSimple = (a) => isObjectAfterSpread(a) || isObjectAfterIdentifier(a); | ||
const isNextSpread = (a) => a.getNextSibling().isSpreadElement(); | ||
const isNextSpreadBetweenObjects = (a) => { | ||
const next = a.getNextSibling(); | ||
const is = next.isSpreadElement(); | ||
if (!is) | ||
return true; | ||
return next.getNextSibling().isObjectExpression(); | ||
}; | ||
@@ -89,2 +99,6 @@ const isInsideOneElementArray = ({parentPath}) => parentPath.node.elements.length === 1; | ||
const is = isNewLine && isCurrentNewLine(element); | ||
if (index && isSpreadElement(element) && !isNextSpread(element) && !isNextObject(element)) | ||
print.newline(); | ||
maybe.indent(is); | ||
@@ -101,3 +115,5 @@ print(element); | ||
print(','); | ||
print.space(); | ||
if (isNextSpreadBetweenObjects(element) || !(element.isObjectExpression() && isNextSpread(element))) | ||
print.space(); | ||
} | ||
@@ -122,3 +138,3 @@ } | ||
if (isSimpleAndEmptyObject(elements)) { | ||
if (isSimpleAndEmptyObject(elements) && !isSpreadElement(elements.at(-1))) { | ||
print(','); | ||
@@ -125,0 +141,0 @@ print.breakline(); |
{ | ||
"name": "@putout/printer", | ||
"version": "8.17.0", | ||
"version": "8.18.0", | ||
"type": "commonjs", | ||
@@ -5,0 +5,0 @@ "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
212204
4712