JavaScript

JavaScript

By DeepSource

Documentation comments not found for functions and classesJS-D1001

Documentation

It is recommended to have comments just before or immediately at the start of a function or class declaration/expression so that anyone who reads the code understands the purpose of the particular function or class.

Examples

Bad Practice

function sum(a, b) {
    return a + b;
}

Recommended

/**
 * Function to add two numbers
 * @param a The first number to add
 * @param b The second number to add
 * @returns The sum of two numbers
 */
function sum(a, b) {
    return a + b;
}