9

It seems that ESDOC targets only ES6 class style.

Is there a way to document a plain object like:

/**
 * ???
 */
var Foo = {
    /**
     * ???
     */
    info: true
};

export default Foo;

And even when using ES6 class style, how to document a static property like:

class Bar {
}

/**
 * ???
 */
Bar.info = true;

export default Bar;
koningdavid
  • 7,903
  • 7
  • 35
  • 46

2 Answers2

5

Short answer. No.

ESDOC is designed specifically to document ES6 classes. It's right in the name. From the FAQ:

ESDoc supports ES2015 and later

If you need to document a mixture of ES6+ and regular (prototypal) classes, JSDOC might be a better bet. It's fairly mature and it's format is a sort of defacto standard.

If you don't like or can't use the main JSDOC package, there are plenty of other options. Just for example, I've had success with jsdoc-to-markdown on my projects. You should be able to find the tools to convert JSDOC to whatever format you need.

leff
  • 575
  • 1
  • 3
  • 12
1

For member and variable you should use @type

/**
* @type {Object}
* @property {boolean} Foo.info describe Foo.info
*/
const Foo = {
   info: true
};

and for static properties in es6 you should use className.method_member

/**
* This is Bar description.
*/
class Bar {
  /**
  * Bar.info
  */
  static info=true
}

check esdoc output here

fingerpich
  • 8,500
  • 2
  • 22
  • 32