Rule: no-void-expression

Requires expressions of type void to appear in statement position.

Rationale

It’s misleading returning the results of an expression whose type is void. Attempting to do so is likely a symptom of expecting a different return type from a function. For example, the following code will log undefined but looks like it logs a value:

const performWork = (): void => {
    workFirst();
    workSecond();
};

console.log(performWork());
Notes:

Config

If ignore-arrow-function-shorthand is provided, () => returnsVoid() will be allowed. Otherwise, it must be written as () => { returnsVoid(); }.

Config examples
Schema
{
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "ignore-arrow-function-shorthand"
    ]
  },
  "minLength": 0,
  "maxLength": 1
}