Skip to content

eslint-factory: close no-github-request-interpolated-route FN gaps for global.getOctokit and const route aliases#45397

Closed
pelikhan with Copilot wants to merge 2 commits into
mainfrom
copilot/eslint-factory-fix-no-github-request-interpolated-again
Closed

eslint-factory: close no-github-request-interpolated-route FN gaps for global.getOctokit and const route aliases#45397
pelikhan with Copilot wants to merge 2 commits into
mainfrom
copilot/eslint-factory-fix-no-github-request-interpolated-again

Conversation

Copilot AI commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

no-github-request-interpolated-route correctly catches direct interpolated routes, but missed two indirection patterns: Octokit clients created via global.getOctokit(...), and interpolated/concatenated routes passed through single-hop const identifiers. This change aligns route resolution behavior with existing client-alias resolution while preserving explicitly out-of-scope forms.

  • Scope resolution: recognize global.getOctokit(...) as Octokit source

    • Added global to the getOctokit member-object allowlist used by client-source detection.
    • Enables detection for aliases like const gh = global.getOctokit(token) before gh.request(...) checks.
  • Route analysis: resolve single-hop const identifier routes

    • Added one-hop identifier resolution for the first request() arg when it is a const-bound identifier.
    • Existing interpolation checks now run on the resolved initializer (template interpolation or non-static + concatenation).
  • Regression coverage

    • Added invalid cases for:
      • const gh = global.getOctokit(token); gh.request(\...${...}`)`
      • const route = \...${...}`; github.request(route, ...)`
      • const route = "..." + owner + "..."; github.request(route, ...)
    • Added valid cases for static single-hop route aliases (literal, static template literal, static literal-only concatenation).
    • Kept and documented out-of-scope behavior for multi-hop route aliases, .concat() route builders, and this.github.request(...).
const gh = global.getOctokit(token);
const route = `GET /repos/${owner}/${repo}`;
gh.request(route, { owner, repo }); // now reported

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix false negatives in no-github-request-interpolated-route rule eslint-factory: close no-github-request-interpolated-route FN gaps for global.getOctokit and const route aliases Jul 14, 2026
Copilot AI requested a review from pelikhan July 14, 2026 07:48
@pelikhan
pelikhan marked this pull request as ready for review July 14, 2026 08:03
Copilot AI review requested due to automatic review settings July 14, 2026 08:03
@pelikhan pelikhan closed this Jul 14, 2026

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

Extends the ESLint rule to detect additional indirect interpolated Octokit routes.

Changes:

  • Recognizes clients created by global.getOctokit(...).
  • Resolves single-hop const route aliases.
  • Adds regression coverage for dynamic and static aliases.
Show a summary per file
File Description
eslint-factory/src/rules/no-github-request-interpolated-route.ts Adds client-source and route-alias resolution.
eslint-factory/src/rules/no-github-request-interpolated-route.test.ts Covers new detections and intentional exclusions.

Review details

Tip

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

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

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

Labels

None yet

Projects

None yet

3 participants