mozilla / sphinx-js

Autodoc-style extraction into Sphinx for your JS project
https://pypi.python.org/pypi/sphinx-js/
MIT License
282 stars 81 forks source link

Use of JSDoc inheritdoc tag produces build failures due to multiple documented objects #128

Open aaclayton opened 4 years ago

aaclayton commented 4 years ago

An annotation which includes the @inheritdoc tag should be ignored, with documentation derived from the parent class.

https://jsdoc.app/tags-inheritdoc.html

Example

class A {
  /**
   * This method returns a number
   * @param {number} x
   * @return {number}
   */
  foo(x) {
    return x;
  }
}

class B extends A {
  /** @inheritdoc */
  foo(x) {
    return x+1;
  }
}

When building jsdoc directly, this works as intended, but when building using sphinx-js it results in the following failure:

sphinx_js.doclets.PathsTaken: Your JS code contains multiple documented objects at each of these paths:

  ./jspath.B#foo

We won't know which one you're talking about. Using JSDoc tags like @class might help you differentiate them.

Since this is a core jsdoc tag, it should be also supported by sphinx-js. Issue is related to https://github.com/mozilla/sphinx-js/issues/110

erikrose commented 4 years ago

Yes, we should at least not crash when somebody uses that tag. :-) Patch welcome! #111 may also be a useful hack around this problem in the meantime.