Skip to content

Files

Latest commit

 

History

History
38 lines (31 loc) · 613 Bytes

require-returns.md

File metadata and controls

38 lines (31 loc) · 613 Bytes

Pattern: Missing return documentation

Issue: -

Description

Functions that return values should document their return value with a @returns tag. Multiple @returns tags on the same function are not allowed.

Examples

Example of incorrect code:

/**
 * Process user data
 */
function processUser(user) {
  return user.id;
}

/**
 * @returns {string} User ID
 * @returns {number} User age
 */
function getUser() {
  return "123";
}

Example of correct code:

/**
 * Process user data
 * @returns {string} User ID
 */
function processUser(user) {
  return user.id;
}