💼🚫 This rule is enabled in the following configs: ☑️ lite
, noStatements
, ✅ recommended
, 🔒 strict
. This rule is disabled in the disableTypeChecked
config.
💭 This rule requires type information.
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.
/* eslint functional/no-return-void: "error" */
function updateText(): void {}
/* eslint functional/no-return-void: "error" */
function updateText(value: string): string {}
This rule accepts an options object of the following type:
type Options = {
allowNull: boolean;
allowUndefined: boolean;
ignoreInferredTypes: boolean;
};
const defaults = {
allowNull: true,
allowUndefined: true,
ignoreInferredTypes: false,
};
If true allow returning null.
If true allow returning undefined.
If true ignore functions that don't explicitly specify a return type.