Disallow functions that are declared as returning nothing.
In functional programming functions must return something, they cannot return nothing.
By default, this rule allows function to return undefined
and null
.
Note: For performance reasons, this rule does not check implicit return types. We recommend using the rule @typescript-eslint/explicit-function-return-type in conjunction with this rule.
Examples of incorrect code for this rule:
/* eslint functional/no-return-void: "error" */
function updateText(): void {
}
Examples of correct code for this rule:
/* eslint functional/no-return-void: "error" */
function updateText(value: string): string {
}
This rule accepts an options object of the following type:
{
allowNull: boolean;
allowUndefined: boolean;
ignoreImplicit: boolean;
}
The default options:
{
allowNull: true,
allowUndefined: true,
ignoreImplicit: false,
}
If true allow returning null.
If true allow returning undefined.
If true ignore functions that don't explicitly specify a return type.