diff --git a/ChangeLog b/ChangeLog index 95a14af8..dca6976c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2023.10.24, v5.37.0 + +feature: +- f01afa3 @putout/printer: TSInterfaceBody: simplify + 2023.10.24, v5.36.0 feature: diff --git a/lib/tokenize/comment/parse-leading-comments.js b/lib/tokenize/comment/parse-leading-comments.js index 9b27b260..2ef051be 100644 --- a/lib/tokenize/comment/parse-leading-comments.js +++ b/lib/tokenize/comment/parse-leading-comments.js @@ -4,17 +4,13 @@ const {types} = require('@putout/babel'); const { hasTrailingComment, satisfy, - isNext, isPrev, - } = require('../is'); const {markBefore} = require('../mark'); const {maybeInsideFn} = require('./maybe-inside-fn'); const { - isTSModuleDeclaration, - isTSInterfaceDeclaration, isObjectProperty, isVariableDeclarator, isClassProperty, @@ -68,8 +64,9 @@ module.exports.parseLeadingComments = (path, {print, maybe, indent}, semantics) if (type === 'CommentBlock') { const looksLikeMethod = path.isClassMethod(); const looksLikeDirective = path.isDirective(); - const looksLikeProp = path.isObjectProperty();// || path.isTSPropertySignature(); + const looksLikeProp = path.isObjectProperty(); + // || path.isTSPropertySignature(); if (looksLikeProp) print.breakline(); diff --git a/lib/tokenize/typescript/interface/ts-interface-declaration.js b/lib/tokenize/typescript/interface/ts-interface-declaration.js index 39124801..53af2087 100644 --- a/lib/tokenize/typescript/interface/ts-interface-declaration.js +++ b/lib/tokenize/typescript/interface/ts-interface-declaration.js @@ -9,7 +9,7 @@ const {isNext, isNextParent} = require('../../is'); const {maybeDeclare} = require('../../maybe/maybe-declare'); module.exports.TSInterfaceDeclaration = { - print: maybeDeclare((path, {print, indent, maybe}) => { + print: maybeDeclare((path, {print, maybe}) => { const {node, parentPath} = path; maybe.indent(!isExportDeclaration(parentPath)); @@ -36,4 +36,3 @@ module.exports.TSInterfaceDeclaration = { print.breakline(); }, }; - diff --git a/lib/tokenize/typescript/ts-property-signature.js b/lib/tokenize/typescript/ts-property-signature.js index 7a919530..a76d1764 100644 --- a/lib/tokenize/typescript/ts-property-signature.js +++ b/lib/tokenize/typescript/ts-property-signature.js @@ -1,11 +1,8 @@ 'use strict'; +const {maybePrintTypeAnnotation} = require('../maybe/maybe-type-annotation'); + const { - maybeTypeAnnotation, - maybePrintTypeAnnotation, -} = require('../maybe/maybe-type-annotation'); -const { - hasLeadingComment, hasTrailingComment, isNext, } = require('../is'); @@ -16,6 +13,7 @@ module.exports.TSPropertySignature = (path, printer) => { maybe, write, } = printer; + const {optional, readonly} = path.node; maybe.print(readonly, 'readonly '); @@ -32,4 +30,3 @@ module.exports.TSPropertySignature = (path, printer) => { if (isNext(path) && hasTrailingComment(path)) write.newline(); }; - diff --git a/lib/tokenize/typescript/type/ts-type-literal.js b/lib/tokenize/typescript/type/ts-type-literal.js index 41597c7a..1887b29b 100644 --- a/lib/tokenize/typescript/type/ts-type-literal.js +++ b/lib/tokenize/typescript/type/ts-type-literal.js @@ -1,8 +1,6 @@ 'use strict'; -const {isNext} = require('../../is'); - -module.exports.TSTypeLiteral = (path, {indent, traverse, write, maybe}) => { +module.exports.TSTypeLiteral = (path, {indent, traverse, write}) => { const members = path.get('members'); write('{'); diff --git a/package.json b/package.json index 4740ace2..3115e53f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@putout/printer", - "version": "5.36.0", + "version": "5.37.0", "type": "commonjs", "author": "coderaiser (https://github.com/coderaiser)", "description": "Simplest possible opinionated Babel AST printer for 🐊Putout",