目录

@typescript-eslint/no-confusing-void-expression

Require expressions of type void to appear in statement position.

void refers to a function return that is meant to be ignored. Attempting to use a void-typed value, such as having it assigned to a variable, provided as a function argument, or returned from a function, can be misleading.

Rule Configuration

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

Options

For details, see @typescript-eslint/no-confusing-void-expression.

Example of Correct Code

export function func(): void {
  console.info('no return');
}

Example of Incorrect Code

export function func(): void {
  return console.info('no return');
}

console.info(func());

Rule Set

plugin:@typescript-eslint/all

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