Skip to content

[no-unused-vars] false positive when generic param name masks name in parent scope #54

Closed
@armano2

Description

@armano2

Repro

{
  "rules": {
    "no-unused-vars": "off",
    "typescript/no-unused-vars": "error"
  }
}
type Foo = number

function test<Foo>(bar: Foo) {
    return bar
}

Expected Result
error that type Foo is not defined

Actual Result
all is good

Additional Info

There is few issues there:

  • markVariableAsUsed is iterating over all variables even if found first one,
  • type parameters are not validated

Versions

package version
eslint-plugin-typescript 1.0.0-rc.1
typescript-eslint-parser internal
typescript 3.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghas prthere is a PR raised to close thispackage: parserIssues related to @typescript-eslint/parserscope 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