jsdoc

Use jsdoc on js with flow type annotations

不想你离开。 提交于 2019-12-05 10:15:49
When trying to process js sources with flow type annotations the jsdoc parser failes to understand the enhanced syntax! Is there a way to use jsdoc in js sources that have been enhanced with flow type annotations or what is the recommended way to generate documentation from type annotated js? sami You could use babel with strip-flow-types transform and use jsdoc-babel . First, you need to install babel and related packages and jsdoc-babel on top of jsdoc. Then, create a jsdoc-conf.json file in your root directory containing something like this: { "plugins": ["node_modules/jsdoc-babel"], "babel

JSDoc - mark some code to not be parsed but retain documentation?

我是研究僧i 提交于 2019-12-05 08:27:36
I'm trying to document a Javascript file with JSDoc(3) like so: /** 1 if gnome-bluetooth is available, 0 otherwise * @type {boolean} * @const */ const HAVE_BLUETOOTH = @HAVE_BLUETOOTH@; Now the file (called config.js.in ) is not on its own valid Javascript; the file gets run through a Makefile which substitutes an appropriate value for @HAVE_BLUETOOTH@ . When I try to run JSdoc on this, it (understandably) balks because of the syntax error in the file. Is there some way to tell JSDoc to ignore all code in this file but simply take into account the annotations ? (I might have to add @name tags

Using JsDoc3 for large apps, How to group modules into sections/categories/submodules

微笑、不失礼 提交于 2019-12-05 08:16:07
I am working on an app wich will become quite huge in time. I have decided to use JsDoc3 and DocStrap to document all modules. Modules are defined via require.js and in some places they are nested up to 3 or 4 levels deep. Untill now I understand that JsDoc documentation is split into four main sections: Modules, Classes, Tutorials, Globals. Each section has a header dropdown menu and a sidebar each of them listing all of the modules in liniar fashion, alphabetically. I was wondering if there are options to display/group modules and Classes somehow to reflect the project structure. I saw a git

How to document an event emitter returned

不想你离开。 提交于 2019-12-05 07:51:30
How to document the events emitted by stream returned in MyFunc() with JSDoc? /** * [MyFunc description] * @param {Object} opts - [description] * @return {Stream} - [description] */ function MyFunc (opts) { // stream is an EventEmitter var stream = new MyEventEmitter(); stream.emit('event1', ... ); stream.emit('event2', ... ); return stream; } Jasmine Hegman You can document these behaviors by documenting your events ( event1 , event2 , ...) as @event MyFunc#event1 and MyFunc, or whoever does the emitting, with @fires MyFunc#event1 . You can also document functions that listen to those events

Is it possible to tell jsdoc to look in a file separate from the source code for documentation of that code?

回眸只為那壹抹淺笑 提交于 2019-12-05 06:01:58
I would like to keep inline comments as short as possible, since my experience is that comments of more than 3 or 4 lines tend to be glossed over, creating a lot of unnecessary "read the manual lines". I'm required by legacy to adhere to a jsdoc-compatible format for documenting code. It requires that a lot of self evident things be declared explicitly if they're to be documented correctly. Practically every tag can fall in this category. Even the ones that don't are often useless to a working developer. My vision is to have a quick summary inside the code itself that developers will actually

Are there any open source JSDoc parser written in Javascript?

廉价感情. 提交于 2019-12-05 03:43:06
I am looking for a JSDoc parser that I can use in my project. I am looking for something where I can pass in a JSDoc comment and receive a structured description of what that comment means. Most of the tools I have seen seem to be able to transform JSDoc comments into HTML or some other format. I am looking for something that will provide the intermediate representation of a comment that can be used to feed into other tools. Are there any tools or libraries out there that I can use? Andrew Eisenberg The Doctrine project does exactly what I am looking for: http://eslint.org/doctrine/demo/ If

How to document a factory that returns a class in angular with ngdoc?

[亡魂溺海] 提交于 2019-12-05 03:01:35
Given an angular app with a factory that returns a class, as such: angular.module('fooApp').factory('User', function(){ function User(name){ this.name = name; } User.prototype.greet = function(){ return "Howdy, " + this.name; } return User; }); Using ngdoc (the special flavor of jsdoc angular uses), how do I document the initializer without defining it as a method? Right now, this is what I've tried: /** * @ngdoc service * @name fooApp.User * @description User factory. */ angular.module('fooApp').factory('User', function(){ /** * @ngdoc method * @methodOf fooApp.User * @name Initializer *

JsDoc: How do I document that an object can have arbritrary (unknown) properties but with a particular type?

久未见 提交于 2019-12-05 01:37:05
This is a similar to question 30360391 . I want to express that the parameter of a function is a plain JS object that can have arbitrary properties (with unknown) names but all properties are objects themselves with fixed properties. An example: The function is just like this /** * @param {Descriptor} desc */ function foo( desc ) { // ... } and a typical desc looks like desc = { unknownEntity1: { priority: 5; writable: false; }, unknownEntity2: { priority: 42; writable: true; }, unknownEntity3: { priority: 9; writable: false; } } I already have /** * @typedef {Object} DescriptorEntry *

What is the correct JSDoc syntax for a local variable?

眉间皱痕 提交于 2019-12-05 00:43:19
For a function like this... function example() { var X = 100; ... var Y = 'abc'; ... return Z; } I need to explain the purpose of some of the local variables. Adding a description like this... function example() { /** * @description - Need to explain the purpose of X here. */ var X = 100; ... /** * @description - Need to explain the purpose of Y here. */ var Y = 'abc'; ... return Z; } ...doesn't seem to be getting picked up by JS Doc v3.4.0 . What is the correct syntax? P.S. Some of my use cases call for multi-line comments. I usually use something like the code below in my projects. function

How can I get JSDoc to mark my param as a jQuery object?

隐身守侯 提交于 2019-12-04 22:18:37
I'm attempting to thoroughly comment my JavaScript and I'm using JSDoc. I have a function that consumes a jQuery object and I'd like to mark the parameter as such. Currently, I have this: /** * Initializes a login object. * @param formEl {JQuery} The login form element on the page. */ var login = function(formEl){ ... } But JSDoc doesn't recognize (or properly format) "JQuery" as a variable type. Any help? OneOfOne According to http://code.google.com/p/jsdoc-toolkit/wiki/TagParam it should be Param type before param name. /** * Initializes a login object. * @param {jQuery} formEl The login