Skip to content
This repository was archived by the owner on Mar 25, 2021. It is now read-only.
This repository was 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

@lcrespom

Description

@lcrespom

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions