jsdoc/require-returns-check
eslint-plugin-jsdoc
import jsdoc from "eslint-plugin-jsdoc";
export default [
{
plugins: { jsdoc },
rules: {
"jsdoc/require-returns-check": "error",
},
},
];Requires a return statement in function body if a @returns tag is specified in JSDoc comment(and reports if multiple @returns tags are present).
/**
* @returns
*/
function quux (foo) {/**
* @returns Foo.
*/
function quux () {Examples from the ESLint documentation.
jsdoc/require-returns-check
eslint-plugin-jsdoc
import jsdoc from "eslint-plugin-jsdoc";
export default [
{
plugins: { jsdoc },
rules: {
"jsdoc/require-returns-check": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Controls how and whether JSDoc blocks can be expressed as single or multiple line blocks.
Ensures that if a @yields is present that a yield (or yield with a value) is present in the function body (or that if a @next is present that there is a yield with a return value present).
Reports types deemed invalid (customizable and with defaults, for preventing and/or recommending replacements).
Reports invalid alignment of JSDoc block asterisks.
Checks for dupe @param names, that nested param names have roots, and that parameter names in function declarations match JSDoc param names.
Requires that all function parameters are documented with a @param tag.