目录

@typescript-eslint/init-declarations

Require or disallow initialization in variable declarations.

Rule Configuration

// code-linter.json5
{
  "rules": {
    "@typescript-eslint/init-declarations": "error"
  }
}

Options

For details, see @typescript-eslint/init-declarations.

Example of Correct Code

// By default, the variable must be initialized at the time of declaration.
export function foo() {
  console.info('hello');
}

export const bar = 1;
export const qux = 3;

Example of Incorrect Code

// By default, the variable must be initialized at the time of declaration.
export function foo() {
  console.info('hello');
}

export let bar: string;
export let qux: number;

Rule Set

plugin:@typescript-eslint/all

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