From 3ff9bf78d87fbb823db1daef354009733a69231a Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Fri, 30 Jan 2026 10:48:53 +0800 Subject: [PATCH] Use `addBlockOrNotComment` in `handleIfStatementComments` (#18803) --- src/language-js/comments/handle-comments.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/language-js/comments/handle-comments.js b/src/language-js/comments/handle-comments.js index 1014829f3..44636a49d 100644 --- a/src/language-js/comments/handle-comments.js +++ b/src/language-js/comments/handle-comments.js @@ -278,18 +278,13 @@ function handleIfStatementComments({ } } - if (followingNode.type === "BlockStatement") { - addBlockStatementFirstComment(followingNode, comment); - return true; - } - // For comments positioned after the condition parenthesis in an if statement // before the consequent without brackets on, such as // if (a) /* comment */ true, // we look at the next character to see if the following node // is the consequent for the if statement if (enclosingNode.consequent === followingNode) { - addLeadingComment(followingNode, comment); + addBlockOrNotComment(followingNode, comment); return true; }