jsduck icon indicating copy to clipboard operation
jsduck copied to clipboard

Case sensitive property names show Object value in documentation

Open incutonez opened this issue 11 years ago • 2 comments

Doing some documentation in my Node.js app, and I decided to use JSDuck for parsing it... I realize it's not meant for Node, but it does a tremendous job at creating documentation, so I figured I'd give it a try.

Anyway, I've got this sample code:

/**
  * @class Blah
  * @author Me
  * @docauthor Me
 */
module.exports = function Blah() {
  /** @property */
  var SOMETHING = 'SOMETHING';
  /** @property */
  var Something = 'Something';
  /** @property */
  var something = 'something';
};

I then go to my index.html of the documentation that's generated and see that all worked well, except for the values of SOMETHING and Something... they appear as Object, instead of the string value. something (all lower case) shows the correct value. Here's an image of what I'm talking about:

bugorfeature

Apologies if this has been reported already, but I couldn't find anything relevant in the search. My JSDuck version is 5.3.4, using Ruby 2.1.1.

incutonez avatar Jan 07 '15 17:01 incutonez

Thanks for reporting. It's a bug.

I guess JSDuck first thinks Something and SOMETHING are going to be a classes as they begin with uppercase letter. Later it turns out, that they're explicitly documented as as @properties but at that point the information of them being a string is already lost.

Until this is fixed, you can just explicitly document all these as strings:

module.exports = function Blah() {
  /** @property {String} */
  var SOMETHING = 'SOMETHING';
  /** @property {String} */
  var Something = 'Something';
  /** @property {String} */
  var something = 'something';
};

nene avatar Jan 08 '15 11:01 nene

Yeah that definitely makes sense for Something. Documenting them as String does indeed make them appear as such in the docs, but it doesn't show their default value... I'd have to explicitly set it after {String}... which seems a bit redundant, as I'd have to maintain a comment of the constant's value. Sorry if that sounds a bit nitpicky.

incutonez avatar Jan 08 '15 14:01 incutonez