complete/strict-void-functions
💼 This rule is enabled in the ✅ recommended config.
📝 Disallows non-empty return statements in functions annotated as returning void.
Rule Details
Section titled “Rule Details”void is different from undefined in that undefined is a value and void
is the lack of any value. Thus, it is confusing if someone is explicitly
returning undefined from a function that is annotated as returning void. In
general, this is indication that either the return type of the function should
be changed to undefined or the predicate of the return statement is
superfluous.
// Badfunction foo(): void { return undefined;}
// Goodfunction foo(): void { return;}
// Goodfunction foo(): undefined { return undefined;}Options
Section titled “Options”This rule is not configurable.
