functional/no-return-void
March 2, 2026 ยท View on GitHub
๐ Disallow functions that don't return anything.
๐ผ This rule is enabled in the following configs: โ๏ธ lite,
noStatements, โ
recommended, ๐ strict.
๐ญ This rule requires type information.
Disallow functions that are declared as returning nothing.
Rule Details
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.
โ Incorrect
/* eslint functional/no-return-void: "error" */
function updateText(): void {}
โ Correct
/* eslint functional/no-return-void: "error" */
function updateText(value: string): string {}
Options
This rule accepts an options object of the following type:
type Options = {
allowNull: boolean;
allowUndefined: boolean;
ignoreInferredTypes: boolean;
};
Default Options
const defaults = {
allowNull: true,
allowUndefined: true,
ignoreInferredTypes: false,
};
allowNull
If true allow returning null.
allowUndefined
If true allow returning undefined.
ignoreInferredTypes
If true ignore functions that don't explicitly specify a return type.