Skip to content

[no-unused-vars] Inconsisitent behaviour with shadowed type name #696

Closed
@fa93hws

Description

@fa93hws

Repro

{
  "rules": {
    "@typescript-eslint/no-unused-vars": ["error"]
  }
}
import { SomeType } from 'foo';
export function fn0(SomeType: SomeType){}

type AnotherType;
export function fn1(AnotherType: AnotherType){}

export function fn2(NonExistedType: NonExistedType) {}

Expected Result
All pass the rule or none of them pass the rule

Actual Result
Import is not OK, but the rest is fine even though the first parameter is not used.
When type node is visited, the parameter is marked as used..😰 see: #363

Additional Info
I know it's not possible to implement this rule without type information which will slow down the linting a lot.. But it should be possible to make the behavior consistent?

Versions

package version
@typescript-eslint/eslint-plugin X.Y.Z
@typescript-eslint/parser X.Y.Z
TypeScript X.Y.Z
ESLint X.Y.Z
node X.Y.Z
npm X.Y.Z

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghas prthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginscope analyserIssues that are caused by bugs/incomplete cases in the scope analyser

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions