@putout/printer
Advanced tools
Comparing version 1.52.4 to 1.53.0
@@ -42,3 +42,11 @@ 'use strict'; | ||
}, | ||
afterIf: shouldAddNewlineAfter, | ||
afterSatisfy: () => [ | ||
noNextParentBlock, | ||
notLastCoupleLines, | ||
isNextAssign, | ||
isNextCoupleLines, | ||
notLastPrevVarNotNextVar, | ||
isNewlineBetweenStatements, | ||
notLastParentExport, | ||
], | ||
after(path, {maybe, store}) { | ||
@@ -63,32 +71,19 @@ const wasNewline = store(); | ||
function shouldAddNewlineAfter(path) { | ||
if (noNextParentBlock(path)) | ||
return true; | ||
function notLastCoupleLines(path) { | ||
return !isLast(path) && isCoupleLines(path); | ||
} | ||
function notLastPrevVarNotNextVar(path) { | ||
const prev = path.getPrevSibling(); | ||
const next = path.getNextSibling(); | ||
if (isLast(path)) | ||
return false; | ||
if (isCoupleLines(path)) | ||
return true; | ||
if (isNextAssign(path)) | ||
return true; | ||
return !isLast(path) && prev.isVariableDeclaration() && !next.isVariableDeclaration(); | ||
} | ||
function isNextCoupleLines(path) { | ||
const next = path.getNextSibling(); | ||
const prev = path.getPrevSibling(); | ||
if (isCoupleLines(next)) | ||
return true; | ||
if (prev.isVariableDeclaration() && !next.isVariableDeclaration()) | ||
return true; | ||
if (isNewlineBetweenStatements(path)) | ||
return true; | ||
if (notLastParentExport(path)) | ||
return true; | ||
return false; | ||
return isCoupleLines(next); | ||
} | ||
const isLast = (path) => path.parentPath?.isProgram() && !isNext(path); | ||
@@ -95,0 +90,0 @@ |
{ | ||
"name": "@putout/printer", | ||
"version": "1.52.4", | ||
"version": "1.53.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
86782
2330