jscs-dev / jscs-jsdoc

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

JSDuck validation should enforce "@param {Type...}" format for variadic arguments #146

Closed Krinkle closed 7 years ago

Krinkle commented 9 years ago

In the latest version of JSCS the "wikimedia" preset now validates documentation comments. However when trying to upgrade, I get the following unexpected error against the oojs repository:

expects valid type instead of Mixed... at src/Factory.js :
    78 | *
    79 | * @param {string} name Object name
    80 | * @param {Mixed...} [args] Arguments to pass to the constructor

This is probably a remnant from the validation originally being written for JSDoc3 and JSDuck5 was added later on.

http://usejsdoc.org/tags-type.html:

Variable number of that type

@param {...number} num

https://github.com/senchalabs/jsduck/wiki/Type-Definitions

  • {String...} - variable number of string arguments.
  • {String[]/Number[]...} - variable number of string or number arrays.

We want to enforce ... as suffix instead of prefix in order to maintain consistency. (So strict on a different detail, not less strict).

/cc @jdforrester

qfox commented 9 years ago

Thanks!

Made a request in jsdoctypeparser.