Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Rule "no-unused-variable" fails to trigger in unused recursive functions #1937

Closed
lcrespom opened this issue Dec 26, 2016 · 1 comment
Closed
Labels

Comments

@lcrespom
Copy link

Bug Report

Rule no-unused-variable fails to trigger in unused recursive functions.

  • TSLint version: 4.1.1
  • TypeScript version: 2.1.4
  • Running TSLint via: VS Code + TSLint extension v0.7.1.

TypeScript code being linted

// Example: typical recursive function
function factorial(x) {
    if ( x > 1)
        return x * factorial(x - 1);
    return 1;
}

with tslint.json configuration:

    "no-unused-variable": true

Actual behavior

No lint error / warning is generated even if factorial is never used.

Expected behavior

An error should be generated if factorial is never used, but because it is used by itself, the linter incorrectly assumes it is already being used.

@andy-hanson
Copy link
Contributor

Since this uses the TypeScript implementatino now (#2235), you should file a bug with TypeScript.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants