Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

empty @inner tag (in wrong place?) crashes very ugly #652

Open
batje opened this issue Jan 9, 2017 · 3 comments · Fixed by #665
Open

empty @inner tag (in wrong place?) crashes very ugly #652

batje opened this issue Jan 9, 2017 · 3 comments · Fixed by #665

Comments

@batje
Copy link
Contributor

batje commented Jan 9, 2017

I developed an AMD module that uses an internal function. I thought it would be nice to tag the documentation of that function with the @inner tag (though it might not be entirely valid). That crashes documentationjs without clean error. Adding some text on the same line after @inner removes the crash.

Code sample:

define([], function() {
  DoSomething();

  /**
   * My Object of Documentation Desire
   * @exports myObject
   */
  var myObject = {};

  return myObject;

  /**
   * DoSomething - Might do something
   *
   * @return {boolean}  Did we really do anything?
   * @inner
   */
  function DoSomething() {
    return false;
  }
});

Error Message:

documentation build src/documentationbug.js -f html -o docs2/ 
/usr/local/lib/node_modules/documentation/lib/commands/build.js:66
      throw err;
      ^

TypeError: Cannot convert undefined or null to object
    at hasOwnProperty (native)
    at /usr/local/lib/node_modules/documentation/lib/hierarchy.js:68:27
    at Array.forEach (native)
    at module.exports (/usr/local/lib/node_modules/documentation/lib/hierarchy.js:38:12)
    at buildSync (/usr/local/lib/node_modules/documentation/index.js:221:5)
    at /usr/local/lib/node_modules/documentation/index.js:147:16
    at /usr/local/lib/node_modules/documentation/lib/input/dependency.js:63:5
    at ConcatStream.<anonymous> (/usr/local/lib/node_modules/documentation/node_modules/concat-stream/index.js:36:43)
    at emitNone (events.js:72:20)
    at ConcatStream.emit (events.js:166:7)

@tmcw
Copy link
Member

tmcw commented Jan 9, 2017

Thanks for the bug report! I won't be able to check this out today but will dig in as soon as possible.

@tmcw
Copy link
Member

tmcw commented Jan 29, 2017

Okay: so inner actually is a scope, and documentation.js hasn't been correctly handling these two mysterious (imho) scopes, global and inner.

I've got a PR that will fix this issue - keep documentation.js from crashing on similar input, and filed an issue on usejsdoc because I can't decipher what the intent or usage of @inner is.

tmcw added a commit that referenced this issue Jan 29, 2017
The purpose and usage of inner is still unclear, unfortunately, so this is an interim fix at best.

Fixes #652
@tmcw tmcw closed this as completed in #665 Jan 29, 2017
tmcw added a commit that referenced this issue Jan 29, 2017
* fix(scopes): Support inner scope

The purpose and usage of inner is still unclear, unfortunately, so this is an interim fix at best.

Fixes #652

* Improve comment typedef while we're at it
@tmcw tmcw reopened this Feb 16, 2017
@tmcw
Copy link
Member

tmcw commented Feb 16, 2017

Reopening: I have new knowledge about what @inner is for, thanks to our friends over at JSDoc, so will take a second pass at making sure our implementation is solid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants