Skip to content

[no-unused-var] False positive when declaring interface in namespace with the same name #2595

Closed
@Guillaume-Mayer

Description

@Guillaume-Mayer
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro
index.d.ts

declare namespace A {
  export interface A {
    foo: string;
  }
}

Expected Result

No warning or a warning if the namespace is never used.

Actual Result

Give me this warning: 'A' is defined but never used., on the namespace (even if it's used).

Versions

package version
@typescript-eslint/eslint-plugin 4.2.0
@typescript-eslint/parser 4.2.0
TypeScript 4.0.3
ESLint 7.9.0
node 12.18.4

Config

parser: "@typescript-eslint/parser"

extends:
- eslint:recommended
- plugin:@typescript-eslint/recommended
- prettier/@typescript-eslint
- plugin:prettier/recommended

parserOptions:
  ecmaVersion: 2019
  sourceType: module
  project: ./tsconfig.json

rules:
  "@typescript-eslint/no-floating-promises": error

ignorePatterns:
- dist/

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomerspackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions