Commit a72712b6fd3 for nodejs

commit a72712b6fd32c3987745ebe7507c107103ec6ebd
Author: Yuya Inoue <65857152+inoway46@users.noreply.github.com>
Date:   Sat Oct 3 18:50:49 2026 +0900

    tools: avoid repeated subtree scans in must-call-assert

    Match the promise call chain before checking for a descendant return
    statement, preserving the existing lint checks.

    Assisted-by: Codex
    Signed-off-by: inoway46 <inoueyuya416@gmail.com>
    PR-URL: https://github.com/nodejs/node/pull/66408
    Refs: https://github.com/nodejs/node/issues/64972
    Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
    Reviewed-By: Filip Skokan <panva.ip@gmail.com>

diff --git a/tools/eslint-rules/must-call-assert.js b/tools/eslint-rules/must-call-assert.js
index b991e29063a..6990e526ad8 100644
--- a/tools/eslint-rules/must-call-assert.js
+++ b/tools/eslint-rules/must-call-assert.js
@@ -135,10 +135,11 @@ module.exports = {
         });
       },

-      [`CallExpression[callee.property.name="then"][arguments.length=1]>CallExpression:matches(${[
+      // Check the call chain before searching descendants for a return.
+      [`:matches(CallExpression[callee.property.name="then"][arguments.length=1]>CallExpression:matches(${[
         '[callee.name="mustCall"]',
         '[callee.object.name="common"][callee.property.name="mustCall"]',
-      ].join(',')})[arguments.length=1]>:has(ReturnStatement)`]: (node) => {
+      ].join(',')})[arguments.length=1]>*):has(ReturnStatement)`]: (node) => {
         context.report({
           node,
           message: 'Cannot mix `common.mustCall` and return statement inside a `.then` chain',