jsdoc

How to document return in JavaScript

会有一股神秘感。 提交于 2019-12-03 16:27:26
问题 I'm writing my own library for the project at work for a browser application and I am having the same old problem deciding how to comment the code. I'm trying to follow the JsDoc syntax, but will probably continue the Google Closure Compiler way. I may end up using two @return and @returns tags in the documentation, just for portability sake (when I setup the auto-generation of the documentation). Now, the question, how do you document the return of a custom anonymous object from a function?

How to document ECMA6 classes with JSDoc?

╄→гoц情女王★ 提交于 2019-12-03 12:32:24
问题 Background I have a project in Nodejs using ECMA6 classes and I am using JSDoc to comment my code, as to make it more accessible to other developers. However, my comments are not well accepted by the tool, and my documentation is a train wreck. Problem My problem is that I don't know how to document ECMA6 classes with JSDoc and I can't find any decent information. What I tried I tried reading the official example but I find it lacking and incomplete. My classes have members, constant

How to force newlines in Google Apps jsdoc descriptions

喜你入骨 提交于 2019-12-03 11:58:36
I can't figure out how in a Google Apps Script to display this correctly. I need it to display new lines in the jsdoc output(e.g. when the function tooltip window comes up in a Spreadheet functions.) I have tried html like however it is just rendered as text and not a line break. For example: /** * Converts the prefixed value to the specified base. * Requires one of the following prefixes: * '0b' Base 2: binary * '0q' Base 4: quaternary * '0o' Base 8: octal * '0x' Base 16: hexadecimal * * @param {string} Value The prefixed value to convert. * @param {number} To The base to convert to. *

How to add and use a tag on jsdoc?

匿名 (未验证) 提交于 2019-12-03 08:48:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am trying to add a customTag to jsdoc. I have created a file in the plugins directory like this: method.js exports . defineTags = function ( dictionary ) { dictionary . defineTag ( "methodHttp" , { mustHaveValue : true , canHaveType : false , canHaveName : true , onTagged : function ( doclet , tag ) { doclet . methodHttp = tag . value ; } }); }; Then I added to my conf.json : { "tags" : { "allowUnknownTags" : true }, "source" : { "includePattern" : ".+\\.js(doc)?$" , "excludePattern" : "(^|\\/|\\\\)_" }, "plugins" : [ "plugins

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

匿名 (未验证) 提交于 2019-12-03 08:46:08
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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

JSDoc typedef in a separate file

喜欢而已 提交于 2019-12-03 08:35:42
问题 Can I define all custom types in a separate file (e.g. types.jsdoc ), so that they can be reused throughout the application? What's the right way to do it? /** * 2d coordinates. * @typedef {Object} Coordinates * @property {Number} x - Coordinate x. * @property {Number} y - Coordinate y. */ 回答1: I just tried with VSCode and it works only if the separate file is opened in the editor. If not, external typedefs are typed as any 回答2: You can define types in a module (eg. typedefs.js ). The module

How do I use JSDoc on Windows?

梦想的初衷 提交于 2019-12-03 07:24:43
问题 Forgive me if this is a daft question but I'm utterly baffled as to how I can use JSDoc on Windows. I'm aware of JSDoc-Toolkit but it's a bit out of date and the google code repository recommends to use JSDoc 3 instead. I have downloaded JSDoc from Github and unzipped the jsdoc-master folder onto my local disk but can't find any solid information as to how to use it to parse my files. 回答1: You can download it as an npm package for the Node.js JavaScript runtime environment. Install Node.js

Document destructured function parameter in JSDoc

妖精的绣舞 提交于 2019-12-03 06:28:11
问题 Previously I've always documented my object parameters as follows: /** * Description of the function * * @param {Object} config - The configuration * @param {String} config.foo * @param {Boolean} [config.bar] - Optional value * @return {String} */ function doSomething (config = {}) { const { foo, bar } = config; console.log(foo, bar); // do something } But I am unsure what the best approach is with desctructured function parameter. Do I just ignore the object, define it somehow or what is the

How to document a Require.js (AMD) Modul with jsdoc 3 or jsdoc?

有些话、适合烂在心里 提交于 2019-12-03 04:50:12
问题 I have 2 types of Modules: Require.js Main File : require.config({ baseUrl: "/another/path", paths: { "some": "some/v1.0" }, waitSeconds: 15, locale: "fr-fr" }); require( ["some/module", "my/module", "a.js", "b.js"], function(someModule, myModule) { } ); Mediator Pattern: define([], function(Mediator){ var channels = {}; if (!Mediator) Mediator = {}; Mediator.subscribe = function (channel, subscription) { if (!channels[channel]) channels[channel] = []; channels[channel].push(subscription); };

Mixing JavaScript and TypeScript in Node.js

爱⌒轻易说出口 提交于 2019-12-03 02:01:22
While having parts of a Node.js in plain ES6, is it possible to mix in some Typescript modules within the same project? E.g. having some Types defined in TypeScript that are imported via require into plain ES6 files? Yes this is possible. Combine the following compiler flags --allowJs Explicitly supports mixed JavaScript and TypeScript sources --outDir Since all files will be transpiled, it is necessary to output the resulting JavaScript into a different directory otherwise the input .js files would be overwritten 1 . --checkJs This is completely optional. If specified, the compiler will