@putout/printer
Advanced tools
Comparing version 11.4.0 to 11.5.0
'use strict'; | ||
const {isExportNamespaceSpecifier} = require('@putout/babel').types; | ||
const {markAfter, isMarkedAfter} = require('../../mark'); | ||
const { | ||
@@ -10,4 +12,2 @@ isNewlineBetweenSiblings, | ||
const {markAfter, isMarkedAfter} = require('../../mark'); | ||
const {isExportNamespaceSpecifier} = require('@putout/babel').types; | ||
const isDeclarationNewline = (path) => isMarkedAfter(path.get('declaration')); | ||
@@ -14,0 +14,0 @@ const isInsideNamespace = (path) => path.parentPath.isTSModuleBlock(); |
'use strict'; | ||
const {isNext, isNextParent} = require('../../is'); | ||
const { | ||
isNext, | ||
isNextParent, | ||
isLast, | ||
} = require('../../is'); | ||
const {markAfter} = require('../../mark'); | ||
module.exports.TSEnumDeclaration = { | ||
@@ -28,8 +34,15 @@ beforeIf(path) { | ||
indent.dec(); | ||
indent(); | ||
print('}'); | ||
if (isLast(path)) | ||
return; | ||
print.newline(); | ||
markAfter(path); | ||
}, | ||
afterSatisfy: () => [isNext, isNextParent], | ||
after(path, {print}) { | ||
print.breakline(); | ||
print.linebreak(); | ||
}, | ||
}; |
'use strict'; | ||
const {types} = require('@putout/babel'); | ||
const { | ||
isTSTypeAliasDeclaration, | ||
isExportDeclaration, | ||
} = require('@putout/babel').types; | ||
isExportNamedDeclaration, | ||
isTSModuleBlock, | ||
} = types; | ||
const {isNext, isNextParent} = require('../../is'); | ||
const {maybeDeclare} = require('../../maybe/maybe-declare'); | ||
const {markAfter} = require('../../mark'); | ||
const isInsideNamespace = (path) => isTSModuleBlock(path.parentPath.parentPath); | ||
module.exports.TSInterfaceDeclaration = { | ||
print: maybeDeclare((path, {print, maybe}) => { | ||
const {node, parentPath} = path; | ||
const {node} = path; | ||
maybe.indent(!isExportDeclaration(parentPath)); | ||
maybe.indent(!isExportNamedDeclaration(path.parentPath)); | ||
print('interface '); | ||
@@ -31,9 +35,11 @@ print('__id'); | ||
after(path, {print}) { | ||
print.breakline(); | ||
print.linebreak(); | ||
const exportNamed = isExportNamedDeclaration(path.parentPath); | ||
const next = path.parentPath.getNextSibling(); | ||
if (exportNamed && isInsideNamespace(path)) | ||
markAfter(path); | ||
if (!isTSTypeAliasDeclaration(next) && !isExportDeclaration(next)) | ||
print.breakline(); | ||
if (!exportNamed && !isTSTypeAliasDeclaration(path)) | ||
print.newline(); | ||
}, | ||
}; |
{ | ||
"name": "@putout/printer", | ||
"version": "11.4.0", | ||
"version": "11.5.0", | ||
"type": "commonjs", | ||
@@ -73,3 +73,3 @@ "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)", | ||
"nodemon": "^3.0.1", | ||
"putout": "^36.0.0", | ||
"putout": "^37.0.1", | ||
"redlint": "^3.16.0", | ||
@@ -76,0 +76,0 @@ "samadhi": "^2.8.0", |
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
241567
5286