diff --git a/src/language-js/print/class.js b/src/language-js/print/class.js index ab6832599..57a9b6a06 100644 --- a/src/language-js/print/class.js +++ b/src/language-js/print/class.js @@ -31,7 +31,6 @@ import { } from "./misc.js"; import { printPropertyKey } from "./property.js"; import { printTypeAnnotationProperty } from "./type-annotation.js"; -import { getTypeParametersGroupId } from "./type-parameters.js"; /** * @import {Doc} from "../../document/index.js" @@ -173,17 +172,6 @@ function hasMultipleHeritage(node) { return count > 1; } -function shouldIndentOnlyHeritageClauses(node) { - return ( - node.typeParameters && - !hasComment( - node.typeParameters, - CommentCheckFlags.Trailing | CommentCheckFlags.Line, - ) && - !hasMultipleHeritage(node) - ); -} - function printHeritageClauses(path, options, print, listName, groupMode) { const { node } = path; if (!isNonEmptyArray(node[listName])) { @@ -210,11 +198,7 @@ function printHeritageClauses(path, options, print, listName, groupMode) { } return [ - shouldIndentOnlyHeritageClauses(node) - ? ifBreak(" ", line, { - groupId: getTypeParametersGroupId(node.typeParameters), - }) - : line, + line, printedLeadingComments, printedLeadingComments && hardline, listName, diff --git a/src/language-js/print/type-parameters.js b/src/language-js/print/type-parameters.js index 955792fc3..cf55297be 100644 --- a/src/language-js/print/type-parameters.js +++ b/src/language-js/print/type-parameters.js @@ -10,7 +10,6 @@ import { softline, } from "../../document/index.js"; import { printDanglingComments } from "../../main/comments/print.js"; -import createGroupIdMapper from "../../utils/create-group-id-mapper.js"; import { CommentCheckFlags, getFunctionParameters, @@ -30,8 +29,6 @@ import { * @import AstPath from "../../common/ast-path.js" */ -const getTypeParametersGroupId = createGroupIdMapper("typeParameters"); - // Keep comma if the file extension not `.ts` and // has one type parameter that isn't extend with any types. // Because, otherwise formatted result will be invalid as tsx. @@ -98,16 +95,13 @@ function printTypeParameters(path, options, print, paramsKey) { ? ifBreak(",") : ""; - return group( - [ - "<", - indent([softline, join([",", line], path.map(print, paramsKey))]), - trailingComma, - softline, - ">", - ], - { id: getTypeParametersGroupId(node) }, - ); + return group([ + "<", + indent([softline, join([",", line], path.map(print, paramsKey))]), + trailingComma, + softline, + ">", + ]); } function printDanglingCommentsForInline(path, options) { @@ -181,4 +175,4 @@ function printTypeParameter(path, options, print) { return group(parts); } -export { getTypeParametersGroupId, printTypeParameter, printTypeParameters }; +export { printTypeParameter, printTypeParameters };