@putout/printer
Advanced tools
Comparing version 1.55.0 to 1.56.0
'use strict'; | ||
const {hasPrevNewline} = require('../../mark'); | ||
const isFirst = (path) => !path.getPrevSibling().node; | ||
const {markAfter} = require('../../mark'); | ||
const {isNext} = require('../../is'); | ||
module.exports.FunctionDeclaration = { | ||
beforeIf(path) { | ||
return !isFirst(path) && !hasPrevNewline(path) && !path.parentPath.isExportDeclaration(); | ||
}, | ||
before(path, {write}) { | ||
write('\n'); | ||
}, | ||
print(path, {print, maybe}) { | ||
@@ -35,2 +29,9 @@ const {async} = path.node; | ||
}, | ||
afterSatisfy: () => [ | ||
isNext, | ||
], | ||
after(path, {write}) { | ||
write.newline(); | ||
markAfter(path); | ||
}, | ||
}; |
@@ -7,4 +7,6 @@ 'use strict'; | ||
const {JSXOpeningElement} = require('./jsx-opening-element'); | ||
const fragments = require('./jsx-fragment'); | ||
module.exports = { | ||
...fragments, | ||
JSXElement, | ||
@@ -11,0 +13,0 @@ JSXAttribute, |
'use strict'; | ||
const { | ||
isNewlineBetweenStatements, | ||
isNext, | ||
} = require('../is'); | ||
const {isNext} = require('../is'); | ||
const {isMarkedAfter} = require('../mark'); | ||
const notClass = (path) => { | ||
@@ -18,13 +13,2 @@ if (!isNext(path)) | ||
module.exports.ExportDefaultDeclaration = { | ||
beforeIf(path) { | ||
const prev = path.getPrevSibling(); | ||
if (isMarkedAfter(prev)) | ||
return false; | ||
return isNewlineBetweenStatements(prev); | ||
}, | ||
before(path, {print}) { | ||
print.newline(); | ||
}, | ||
print(path, {print, traverse, maybe}) { | ||
@@ -31,0 +15,0 @@ const declaration = path.get('declaration'); |
{ | ||
"name": "@putout/printer", | ||
"version": "1.55.0", | ||
"version": "1.56.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
90611
64
2432