1

If I am developing a node module something-nifty which has the following directory structure:

something-nifty/
    lib/
        plugins/
            Plugin.cs
    index.js
    package.json

And plugin.cs is defined as follows:

"use strict";

/**
 * @module something-nifty/lib/plugins/Plugin
 */

/**
 * The base class for a 'something-nifty' plugin.
 */
class Plugin {
    /**
     * Constructs the plugin...
     */
    constructor() {
    }
}

module.exports = Plugin;

In the generated documentation the class is documented as though it has the @inner tag which means that I need to repeat the class name twice whenever I refer to it:

"use strict";

/**
 * @module something-nifty/lib/foo
 */

/**
 * Foo...
 * @param {module:something-nifty/lib/plugins/Plugin~Plugin} plugin
 */
exports.abc = function(plugin) { ... };

Surely I shouldn't need to specify the class name twice in this situation since the module is essentially the class. What is the correct way to annotate this with jsdoc3 tags such that it outputs documentation that is properly structured (module and class listings)?

Felix Kling
  • 795,719
  • 175
  • 1,089
  • 1,143
Lea Hayes
  • 62,536
  • 16
  • 62
  • 111

1 Answers1

0

Having spent some time searching the best that I have been able to find is this is to (in my opinion) "misuse" the @alias tag like shown in the following snippet:

"use strict";

/**
 * @module something-nifty/lib/plugins/Plugin
 */

/**
 * The base class for a 'something-nifty' plugin.
 * @alias module:something-nifty/lib/plugins/Plugin
 */
class Plugin {
    /**
     * Constructs the plugin...
     */
    constructor() {
    }
}

module.exports = Plugin;

The following link refers to the article where I picked up on this @alias trick: http://www.pagosoft.com/javascript/using-jsdoc-amd-modules/

Lea Hayes
  • 62,536
  • 16
  • 62
  • 111