jscs-dev / jscs-jsdoc

JsDoc validation rules for jscs
MIT License
99 stars 35 forks source link

New Rule: parameters require description #107

Closed dtracers closed 9 years ago

dtracers commented 9 years ago

I would like a rule that says all parameters must require a description.

That way you can not just add a parameter but not describe what it is.

(not sure how to implement this one though)

qfox commented 9 years ago

One sentence per @param?

dtracers commented 9 years ago

I was thinking it required at least a letter or digit after the name.

/**
 * @param {Type} name validDescription
 */
function foo(name) {
}

But this throws an error.

/**
 * @param {Type} name
 */
function foo(name) {
}

Also another way people write these (just to think about supporting)

/**
 * @param {Type} name
 *                     Description on the next line some number of spaces over.  Which looks nicer
 *                     For very large descriptions that typically do not fit on one line.
 * @param {Type} name2
 *                    This also makes it easier to tell when each description starts.
 */
function foo(name, name2) {
}

But this second one would probably be a separate rule about all param descriptions must be on the next line

qfox commented 9 years ago

I was thinking it required at least a letter or digit after the name.

It's a simple rule, actually. Something like requireParamsDescription.

Just need to iterate thru nodes with param type and check for emptiness of desc property.

But this second one would probably be a separate rule about all param descriptions must be on the next line

:+1: More complex but still not hard to make.

Feel free to make it ;-)

qfox commented 9 years ago

@dtracers Thank you for you hard work here.

Published as v1.1.0! ;-)