Skip to content

Instantly share code, notes, and snippets.

@mcous
Last active February 24, 2019 23:23
Show Gist options
  • Save mcous/3c80c5b0b901edb971014cd05a97a987 to your computer and use it in GitHub Desktop.
Save mcous/3c80c5b0b901edb971014cd05a97a987 to your computer and use it in GitHub Desktop.
@typescript-eslint/no-unused-var error in namespace
'use strict'
module.exports = {
root: true,
extends: ['plugin:@typescript-eslint/recommended'],
rules: {
'@typescript-eslint/no-unused-vars': 'error',
},
}
node_modules
package-lock.json

overview

npm run lint
  • @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

expected

No errors

actual

If a function parameter matches the function name, the function name is marked as "unused"

// types.d.ts
declare namespace Foo {
    function foo(foo: string): void // 'foo' is defined but never used.
}
{
"name": "unused-function-param",
"private": true,
"version": "1.0.0",
"description": "",
"scripts": {
"lint": "eslint '**/*.ts'"
},
"keywords": [],
"author": "Mike Cousins <mike@cousins.io> (https://mike.cousins.io)",
"license": "MIT",
"devDependencies": {
"@typescript-eslint/eslint-plugin": "1.4.1",
"eslint": "5.14.1",
"typescript": "3.3.3333"
}
}
declare namespace Foo {
function foo(foo: string): void
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment