Remove dead code (#18217)

This commit is contained in:
fisker Cheung authored and GitHub committed 2025-11-16 21:56:58 +08:00
1 parent 4c4792fe64
commit 8d29f18fee
2 files changed
+9 -31

No files matched your search

+1 -17
View File
@@ -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,
+8 -14
View File
@@ -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 };