2017-08-11 72 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 
**/