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-var] False positive for imported interfaces used in declare global #1302

Closed
flopes89 opened this issue Dec 4, 2019 · 3 comments
Closed
Labels
package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look

Comments

@flopes89
Copy link

flopes89 commented Dec 4, 2019

Repro

{
  "plugins": ["react", "@typescript-eslint"],
  "extends": ["eslint:recommended", "plugin:react/recommended", "plugin:@typescript-eslint/recommended"],
  "rules": {
    "no-unused-vars": "warn",
  }
}
// ../server/servicesTypes.ts

export interface Token {
	principal_id: string;
}
import { Token } from "../server/servicesTypes";

declare global {
	namespace Express {
		export interface Request {
			token: Token;
		}
	}
}

Expected Result

File does not yield any warnings.

Actual Result

ESLint warning on the import line:

ESLint: 'Token' is defined but never used. (no-unused-vars)

Additional Info

When I remove the declare global and instead export namespace is the top-most declaration, the warning goes away.

Versions

package version
@typescript-eslint/eslint-plugin 2.6.0
@typescript-eslint/parser 2.6.0
TypeScript 3.6.2
ESLint 6..6.0
node 10.15.3
npm 6.4.1
@flopes89 flopes89 added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Dec 4, 2019
@bradzacher
Copy link
Member

please use our rule @typescript-eslint/no-unused-vars-experimental instead

@ma-zal
Copy link

ma-zal commented Jan 3, 2020

@bradzacher Can you provide details, how to use it? I was not able to found the documentation.

please use our rule @typescript-eslint/no-unused-vars-experimental instead

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look
Projects
None yet
Development

No branches or pull requests

4 participants