Skip to content

chore: remove withinDeferredBoundary dead code in require-execsync-try-catch rule - #47233

Merged
pelikhan merged 2 commits into
mainfrom
copilot/remove-dead-code-within-deferred-boundary
Jul 22, 2026
Merged

chore: remove withinDeferredBoundary dead code in require-execsync-try-catch rule#47233
pelikhan merged 2 commits into
mainfrom
copilot/remove-dead-code-within-deferred-boundary

Conversation

Copilot AI commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

withinDeferredBoundary was computed in the CallExpression visitor but immediately discarded via void withinDeferredBoundary — the rule always reported regardless of its value. Dead code with misleading comments.

Changes

  • eslint-factory/src/rules/require-execsync-try-catch.ts: Remove the ancestors traversal, withinDeferredBoundary variable, its loop, and the surrounding comments (old lines 148–160)
  • Remove now-unused isDeferredCallback from the import
-        // Ignore execSync inside deferred callbacks — the parent try block does not protect them.
-        const ancestors = sourceCode.getAncestors(node);
-        let withinDeferredBoundary = false;
-        for (let i = ancestors.length - 1; i >= 0; i--) {
-          if (isDeferredCallback(ancestors[i])) {
-            withinDeferredBoundary = true;
-            break;
-          }
-        }
-        // Still flag it even in deferred callbacks — execSync in async callbacks is still risky.
-        void withinDeferredBoundary;
-
         const argText = node.arguments.length > 0 ? sourceCode.getText(node.arguments[0]) : "";

No behavior change. isInsideTryBlock already handles the deferred-boundary logic correctly via its own crossedDeferredBoundary traversal.

…y-catch rule

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove dead code in require-execsync-try-catch rule chore: remove withinDeferredBoundary dead code in require-execsync-try-catch rule Jul 22, 2026
Copilot AI requested a review from pelikhan July 22, 2026 08:12
@pelikhan
pelikhan marked this pull request as ready for review July 22, 2026 08:27
Copilot AI review requested due to automatic review settings July 22, 2026 08:27
@pelikhan
pelikhan merged commit cd04f12 into main Jul 22, 2026
1 check passed
@pelikhan
pelikhan deleted the copilot/remove-dead-code-within-deferred-boundary branch July 22, 2026 08:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes misleading dead code from the require-execsync-try-catch ESLint rule without changing behavior.

Changes:

  • Removed the unused deferred-boundary traversal.
  • Removed the now-unused isDeferredCallback import.
Show a summary per file
File Description
eslint-factory/src/rules/require-execsync-try-catch.ts Simplifies the rule by removing redundant logic and import.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Medium

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.83.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Code Quality] Remove dead code withinDeferredBoundary in require-execsync-try-catch rule (lines 148-160)

3 participants