目录

@typescript-eslint/no-redeclare

Disallow variable redeclaration.

Rule Configuration

// code-linter.json5
{
  "rules": {
    "@typescript-eslint/no-redeclare": "error"
  }
}

Options

For details, see @typescript-eslint/no-redeclare.

Example of Correct Code

let a = '3';
a = '10';
console.info(a);

export class C {
  static {
    let c = '3';
    c = '10';
    console.info(c);
  }

  public foo() {
    let b = '3';
    b = '10';
    console.info(b);
  }
}

Example of Incorrect Code

// Variable a cannot be declared repeatedly.
const a = '3';
const a = '10';

export class C {
  static {
    // Variable c cannot be declared repeatedly.
    const c = '3';
    const c = '10';
  }

  public foo() {
    // Variable b cannot be declared repeatedly.
    const b = '3';
    const b = '10';
  }
}

Rule Set

plugin:@typescript-eslint/all

For details about how to configure Code Linter check rules, see Code Linter.