Skip to content

[no-unused-vars] False negative if param name matches function name in namespace #316

Closed
@mcous

Description

@mcous

Hiya! Thanks for all the hard work on this project; I really appreciate how easy it's been to add Typescript linting to my existing ESLint config in a mixed language repo.

I upgraded a project from 1.3.0 to 1.4.1 and noticed a new error in a namespace that doesn't look right to me. I'm relatively new to Typescript (so please forgive me if I'm missing something basic here), but here's what I've got:

Repro

https://gist.github.com/mcous/3c80c5b0b901edb971014cd05a97a987

module.exports = {
  root: true,
  extends: ['plugin:@typescript-eslint/recommended'],
  rules: {
    '@typescript-eslint/no-unused-vars': 'error',
  },
}
// types.d.ts
declare namespace Foo {
    function foo(foo: string): void // 'foo' is defined but never used.
}

Expected Result

No errors

Actual Result

error  'foo' is defined but never used  @typescript-eslint/no-unused-vars

Additional Info

  • @typescript-eslint/eslint-plugin@1.3.0 - no errors
  • @typescript-eslint/eslint-plugin@1.4.0 - error
  • @typescript-eslint/eslint-plugin@1.4.1 - error

Versions

package version
@typescript-eslint/eslint-plugin 1.4.1
@typescript-eslint/parser 1.4.1
TypeScript 3.3.3333
ESLint 5.14.1
node 8.11.2
npm 6.8.0

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