yui / yuidoc

YUI Javascript Documentation Tool
http://yui.github.com/yuidoc
Other
891 stars 211 forks source link

Auto-detect tags from ES6 syntax #336

Open balupton opened 9 years ago

balupton commented 9 years ago

Considering ES6 now has proper classes, with static, getters, setters, consts, constructors, and all the rest. It's quite annoying to have to specify duplicate data inside the code and then again inside the YUIDoc tags.

E.g.

/**
 * Our Task Class
 * @extends BaseEventEmitter
 * @class Task
 * @public
 */
class Task extends BaseEventEmitter {
    /**
     * A helper method to check if the passed argument is an instanceof a {Task}
     * @method isTask
     * @static
     * @public
     * @param {Task} item - The possible instance of the {Task} that we want to check
     * @return {Boolean} Whether or not the item is a {Task} instance.
     */
    static isTask (item) {
        return (item && item.type === 'task') || (item instanceof Task)
    }
}

Should just be:

/**
 * Our Task Class
 */
class Task extends BaseEventEmitter {
    /**
     * A helper method to check if the passed argument is an instanceof a {Task}
     * @param {Task} item - The possible instance of the {Task} that we want to check
     * @return {Boolean} Whether or not the item is a {Task} instance.
     */
    static isTask (item) {
        return (item && item.type === 'task') || (item instanceof Task)
    }
}

As the removed tags are obvious from the code.

okuryu commented 9 years ago

YUIDoc doesn't rely the actual source code syntax by design to works for flexibility with many syntaxes.