@putout/printer
Advanced tools
@@ -8,2 +8,5 @@ 'use strict'; | ||
const not = (fn) => (...a) => !fn(...a); | ||
const notInsideExportDefaultWithBody = not(isInsideExportDefaultWithBody); | ||
const { | ||
@@ -16,2 +19,3 @@ isAssignmentExpression, | ||
isFunctionDeclaration, | ||
isExportDefaultDeclaration, | ||
} = types; | ||
@@ -55,7 +59,7 @@ | ||
afterSatisfy: () => [isNext, isNextParent, isInsideBlockStatement], | ||
after(path, {write, indent}) { | ||
after(path, {indent, maybe}) { | ||
if (isNextAssign(path) || isNextFunction(path)) | ||
indent(); | ||
write.newline(); | ||
maybe.write.newline(notInsideExportDefaultWithBody(path)); | ||
markAfter(path); | ||
@@ -90,1 +94,8 @@ }, | ||
} | ||
function isInsideExportDefaultWithBody(path) { | ||
if (!isExportDefaultDeclaration(path.parentPath)) | ||
return false; | ||
return path.node.body.body.length; | ||
} |
@@ -15,2 +15,3 @@ 'use strict'; | ||
isFunctionDeclaration, | ||
isExpressionStatement, | ||
} = types; | ||
@@ -107,3 +108,5 @@ | ||
if (path === partOfAlternate && isInside(path)) | ||
const nextPath = path.parentPath.getNextSibling(); | ||
if (path === partOfAlternate && isInside(path) && !isExpressionStatement(nextPath)) | ||
print.newline(); | ||
@@ -110,0 +113,0 @@ |
{ | ||
"name": "@putout/printer", | ||
"version": "14.0.0", | ||
"version": "14.0.1", | ||
"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
266144
0.22%5777
0.17%