Requires that returns are documented.
Will also report if multiple @returns
tags are present.
checkConstructors
- A value indicating whetherconstructor
s should be checked for@returns
tags. Defaults tofalse
.checkGetters
- Boolean to determine whether getter methods should be checked for@returns
tags. Defaults totrue
.exemptedBy
- Array of tags (e.g.,['type']
) whose presence on the document block avoids the need for a@returns
. Defaults to an array withinheritdoc
. If you set this array, it will overwrite the default, so be sure to add backinheritdoc
if you wish its presence to cause exemption of the rule.forceRequireReturn
- Set totrue
to always insist on@returns
documentation regardless of implicit or explicitreturn
's in the function. May be desired to flag that a project is aware of anundefined
/void
return. Defaults tofalse
.forceReturnsWithAsync
- By defaultasync
functions that do not explicitly return a value pass this rule as anasync
function will always return aPromise
, even if thePromise
resolves to void. You can force allasync
functions (including ones with an explicitPromise
but no detected non-undefined
resolve
value) to require@return
documentation by settingforceReturnsWithAsync
totrue
on the options object. This may be useful for flagging that there has been consideration of return type. Defaults tofalse
.contexts
- Set this to an array of strings representing the AST context (or an object withcontext
andcomment
properties) where you wish the rule to be applied. Overrides the default contexts (see below). Set to"any"
if you want the rule to apply to any jsdoc block throughout your files (as is necessary for finding function blocks not attached to a function declaration or expression, i.e.,@callback
or@function
(or its aliases@func
or@method
) (including those associated with an@interface
). This rule will only apply on non-default contexts when there is such a tag present and theforceRequireReturn
option is set or if theforceReturnsWithAsync
option is set with a present@async
tag (since we are not checking against the actualreturn
values in these cases).
Context | ArrowFunctionExpression , FunctionDeclaration , FunctionExpression ; others when contexts option enabled |
Tags | returns |
Aliases | return |
Recommended | true |
Options | checkConstructors , checkGetters , contexts , exemptedBy , forceRequireReturn , forceReturnsWithAsync |
Settings | ignoreReplacesDocs , overrideReplacesDocs , augmentsExtendsReplacesDocs , implementsReplacesDocs |