Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[no-unused-vars] Variables used in an ambient declaration are not detected #2026

Closed
andreubotella opened this issue May 14, 2020 · 1 comment
Labels
duplicate This issue or pull request already exists package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@andreubotella
Copy link

andreubotella commented May 14, 2020

Repro

{
  "rules": {
    "@typescript-eslint/no-unused-vars": ["error"]
  }
}
import { Octokit } from "@octokit/rest";

declare global {
  namespace Express {
    interface Request {
      githubApi?: Octokit;
    }
  }
}

Expected Result

No ESLint problems are detected.

Actual Result

An error for @typescript-eslint/no-unused-vars shows up: "'Octokit' is defined but never used". If the Octokit type is used elsewhere other than in an ambient declaration, the error goes away.

Additional Info

This might be a case covered in the meta-issue #1856, but I don't know enough about the internals of typescript-eslint to know for sure.

Versions

package version
@typescript-eslint/eslint-plugin 2.33.0
@typescript-eslint/parser 2.33.0
TypeScript 3.9.2
ESLint 7.0.0
node 12.16.3
npm 6.14.4
@andreubotella andreubotella added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels May 14, 2020
@bradzacher
Copy link
Member

#1856 will solve it

@bradzacher bradzacher added duplicate This issue or pull request already exists and removed triage Waiting for maintainers to take a look labels May 14, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

No branches or pull requests

2 participants