2017-08-11 70 views
1

我被要求为我们的开发人员创建一个JSDoc模板来记录他们的ES6代码。我不确定哪个70 or so @ block tags会有用,以及我是否会让开发人员陷入过多的文档要求。 documentation给出了非常简单的例子,这实际上没有帮助。手动JSDoc注释 - 创建模板

寻找对经验丰富的JavaScript开发人员最有用的一组块标签的真实世界体验。当我问我们的时候,他们只会说:“无论你决定!”,但称他们为有经验的JavaScript开发人员接近3:1的谎言:短语比例。

回答

1

我发现以下提供的信息不会给开发人员带来负担。

对于类:

/** 
* The XYZ class description .... In this class function1, and 
* function2 are intended for external use. 
* 
* @author  ... 
* @version  1.0 
* @see   XYZ.function1 
* @see   XYZ.function2 
**/ 

对于构造函数:

/** 
* The constructor ... 
* 
* @author  ... 
* @constructor 
* @this   instance of XYZ 
**/ 

对于构造私有成员:

/** @private **/ this.x = 1; 
/** @private **/ this.y = 2; 
/** @private **/ this.z = 3; 

对于函数:

/** 
* The function ... 
* 
* @author  ... 
* @param   {type|otherType} X - description 
* @param   {type=} Y - optional, description 
* @param   {type=3} Z - default value, description 
* @return  {type} - description, omit if nothing returned 
* @this   instance of XYZ, or XYZ class for static functions 
* @private  omit if not private 
* @see   XYZ.function, provide if another function is relevant 
* @throws  exception, omit if no exceptions are thrown 
**/