From 91625a1220ae53468b5a6d1f57d33f3fe9f3bf86 Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Mon, 2 Feb 2026 20:16:09 +0800 Subject: [PATCH] Clean js plugins (#18839) --- ...-x-statement.js => handle-for-x-statement-comments.js} | 4 ++-- src/language-js/comments/handle-comments.js | 8 ++++---- src/language-js/print/estree.js | 2 -- 3 files changed, 6 insertions(+), 8 deletions(-) rename src/language-js/comments/attach/{handle-for-x-statement.js => handle-for-x-statement-comments.js} (90%) diff --git a/src/language-js/comments/attach/handle-for-x-statement.js b/src/language-js/comments/attach/handle-for-x-statement-comments.js similarity index 90% rename from src/language-js/comments/attach/handle-for-x-statement.js rename to src/language-js/comments/attach/handle-for-x-statement-comments.js index f9009b1b0..5feddb8f2 100644 --- a/src/language-js/comments/attach/handle-for-x-statement.js +++ b/src/language-js/comments/attach/handle-for-x-statement-comments.js @@ -2,7 +2,7 @@ import { addLeadingComment } from "../../../main/comments/utilities.js"; import { locStart } from "../../loc.js"; import { stripComments } from "../../utilities/strip-comments.js"; -function handleForXComments({ +function handleForXStatementComments({ comment, enclosingNode, followingNode, @@ -29,4 +29,4 @@ function handleForXComments({ return false; } -export { handleForXComments }; +export { handleForXStatementComments }; diff --git a/src/language-js/comments/handle-comments.js b/src/language-js/comments/handle-comments.js index c5ca32df8..c71d8c7a6 100644 --- a/src/language-js/comments/handle-comments.js +++ b/src/language-js/comments/handle-comments.js @@ -29,7 +29,7 @@ import { isUnionType, } from "../utilities/node-types.js"; import { stripComments } from "../utilities/strip-comments.js"; -import { handleForXComments } from "./attach/handle-for-x-statement.js"; +import { handleForXStatementComments } from "./attach/handle-for-x-statement-comments.js"; import { handleIfStatementComments } from "./attach/handle-if-statement-comments.js"; import { handleWhileLikeComments } from "./attach/handle-while-like-comments.js"; import { @@ -71,7 +71,7 @@ function handleOwnLineComment(context) { handleWhileLikeComments, handleTryStatementComments, handleClassComments, - handleForXComments, + handleForXStatementComments, handleUnionTypeComments, handleMatchOrPatternComments, handleOnlyComments, @@ -101,7 +101,7 @@ function handleEndOfLineComment(context) { handleWhileLikeComments, handleTryStatementComments, handleClassComments, - handleForXComments, + handleForXStatementComments, handleLabeledStatementComments, handleCallExpressionComments, handlePropertyComments, @@ -127,7 +127,7 @@ function handleRemainingComment(context) { handleIgnoreComments, handleIfStatementComments, handleWhileLikeComments, - handleForXComments, + handleForXStatementComments, handleMethodNameComments, handleOnlyComments, handleTSMappedTypeComments, diff --git a/src/language-js/print/estree.js b/src/language-js/print/estree.js index 698fb38b8..300bafc9f 100644 --- a/src/language-js/print/estree.js +++ b/src/language-js/print/estree.js @@ -281,12 +281,10 @@ function printEstree(path, options, print, args) { return printTryStatement(path, options, print); case "CatchClause": return printCatchClause(path, options, print); - // Note: ignoring n.lexical because it has no printing consequences. case "SwitchStatement": return printSwitchStatement(path, options, print); case "SwitchCase": return printSwitchCase(path, options, print); - // JSX extensions below. case "DebuggerStatement": return ["debugger", options.semi ? ";" : ""];