@putout/printer
Advanced tools
Comparing version 12.29.0 to 12.30.0
@@ -14,2 +14,7 @@ 'use strict'; | ||
const { | ||
hasCommentsPrinter, | ||
printComments, | ||
} = require('./comments-printer/comments-printer'); | ||
const { | ||
isArrowFunctionExpression, | ||
@@ -51,5 +56,2 @@ isObjectProperty, | ||
if (path.node.decorators) | ||
return true; | ||
return path?.parentPath.node?.decorators; | ||
@@ -95,3 +97,9 @@ }; | ||
module.exports.parseLeadingComments = (path, {print, maybe, indent}, semantics) => { | ||
module.exports.parseLeadingComments = (path, printer, semantics, {currentTraverse = {}} = {}) => { | ||
const { | ||
print, | ||
maybe, | ||
indent, | ||
} = printer; | ||
if (!semantics.comments) | ||
@@ -105,2 +113,7 @@ return; | ||
if (hasCommentsPrinter(currentTraverse)) | ||
return printComments(path, printer, semantics, { | ||
currentTraverse, | ||
}); | ||
if (hasDecoratorsWithComments(path)) | ||
@@ -107,0 +120,0 @@ return; |
@@ -222,3 +222,6 @@ 'use strict'; | ||
const currentIndent = i; | ||
parseLeadingComments(path, printer, semantics); | ||
parseLeadingComments(path, printer, semantics, { | ||
currentTraverse, | ||
}); | ||
// this is main thing | ||
@@ -225,0 +228,0 @@ maybeVisitor(currentTraverse, path, printer, semantics); |
@@ -43,3 +43,17 @@ 'use strict'; | ||
print('__parameter'); | ||
maybe.print.breakline(decoratorsLength); | ||
if (hasLeadingComment(path) && !path.node.decorators) | ||
print.breakline(); | ||
}; | ||
module.exports.TSParameterProperty.printLeadingCommentLine = (path, printer, semantics, {printComment}) => { | ||
const {indent, print} = printer; | ||
if (path.parentPath.isClassMethod() && !path.node.decorators) { | ||
indent.inc(); | ||
print.breakline(); | ||
printComment(); | ||
print.breakline(); | ||
indent.dec(); | ||
} | ||
}; |
{ | ||
"name": "@putout/printer", | ||
"version": "12.29.0", | ||
"version": "12.30.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
260933
153
5683