From 42d384d1483d5bfe16b5a1c38e7f2cb6141cf9fa Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Sun, 18 Jan 2026 08:32:47 +0800 Subject: [PATCH] Remove useless optional chaining (#18677) --- src/language-js/parse/postprocess/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/language-js/parse/postprocess/index.js b/src/language-js/parse/postprocess/index.js index 08fa714b9..2f5f72b9f 100644 --- a/src/language-js/parse/postprocess/index.js +++ b/src/language-js/parse/postprocess/index.js @@ -138,8 +138,9 @@ function postprocess(ast, options) { // fix unexpected locEnd caused by --no-semi style case "VariableDeclaration": { const lastDeclaration = node.declarations.at(-1); - if (lastDeclaration?.init && text[locEnd(lastDeclaration)] !== ";") { + if (lastDeclaration.init && text[locEnd(lastDeclaration)] !== ";") { node.range = [locStart(node), locEnd(lastDeclaration)]; + break; } break; }