Skip to content

JSDoc shortcomings #21

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

Closed
tmcw opened this issue Mar 13, 2015 · 10 comments
Closed

JSDoc shortcomings #21

tmcw opened this issue Mar 13, 2015 · 10 comments

Comments

@tmcw
Copy link
Member

tmcw commented Mar 13, 2015

We know of a few JSDoc oddities with no clear solution. Let's keep track of them here.

@tmcw
Copy link
Member Author

tmcw commented Apr 8, 2015

  • Documenting input object types: the tradition is multiple param tags with foo.bar - we need to support that fully.

@shawnbot
Copy link

I think this might be one: it seems really difficult to use JSDoc for d3-style functions that return configurable functions with attached methods. I've tried every combination of @memberof!, @instance and similar tags with no success. Something like this:

/**
 * an area chart generator
 * @class area
 */
var area = function() {
  /** @lends area# */
  var chart = function(selection) { };
  /** @method */
  chart.data = function(_) { };
  return chart;
};

Is @class just a bad fit for these or what?

@tmcw
Copy link
Member Author

tmcw commented Apr 24, 2015

@shawnbot yeah: I don't think that the @class tag describes the object factory idea very well:

/**
 * area chart generator
 * @returns {chart}
 */
var area = function() {

  /**
   * Run a chart over a given selection
   * @param {Selection} selection
   */
  var chart = function(selection) {
  };

  /**
   * Sets the chart data.
   */
  chart.data = function(_) {
  };

  return chart;
};

This works perfectly fine in my testing - differentiating the factory function from the thing that it returns.

@shawnbot
Copy link

Nice, good call @tmcw.

@shawnbot
Copy link

Well, actually, not quite: I can't get the method (chart.data) to nest under the chart definition in the docs. It just goes into the main listing without a namespace. That's actually why I tried to do it with @class: I assumed you couldn't attach methods to functions any other way.

@tmcw
Copy link
Member Author

tmcw commented Apr 24, 2015

Odd: it does so with my install, I'll test this again...

@mister-walter
Copy link

@shawnbot , did you ever get something working? @tmcw 's example doesn't compile right for me at all, it doesn't generate a class definition for 'chart'. I'm not sure if I'm not doing something right, or if JsDoc has changed its behavior.

@shawnbot
Copy link

Nope, sorry @mister-walter. I haven't used jsdoc in a while, so I don't have anything handy to test with. 😕

@tmcw
Copy link
Member Author

tmcw commented Jan 29, 2017

Filing - upstream issue with JSDoc about the uncertain meaning and usage of @inner

@tmcw tmcw removed the help wanted label Apr 15, 2017
@tmcw
Copy link
Member Author

tmcw commented Oct 13, 2017

Moving discussion to dx-spec https://github.com/tmcw/dx-spec/issues

@tmcw tmcw closed this as completed Oct 13, 2017
rhendric pushed a commit to rhendric/documentation that referenced this issue Sep 15, 2022
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

No branches or pull requests

3 participants