jscs-dev / jscs-jsdoc

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

checkReturnTypes for instances #115

Closed markelog closed 9 years ago

markelog commented 9 years ago

For example

/**
 * Clones current Element structure.
 *
 * @returns {Element}
 */
cloneElement() {
    let clonedChildren = new Array(this._childElements.length);
    for (let i = 0; i < clonedChildren.length; i++) {
        clonedChildren[i] = this._childElements[i].cloneElement();
    }
    return new this.constructor(clonedChildren);
}

checkReturnTypes will report violation, when it probably shouldn't

markelog commented 9 years ago

Or, correct way would be

* @returns {Object} Element instance

/cc @mdevils ?

qfox commented 9 years ago

Hmm, I think no, it shouldn't. It just try to compare Element with this.constructor I think.

We can skip this check, or maybe we can try to check it somehow?