![](/img/trans.png)
[英]Have JSDoc generate documentation for private (non-exported) functions in module
[英]Why is it that “Member must not have @private JsDoc”?
我正在使用Google Closure Tools中的gjslint工具清理我的代碼。 它報告以下錯誤:
Line 15, E:0222: Member "this._dictionary" must not have @private JsDoc
這是代碼:
/**
* Stacker class.
* @constructor
* @param {frankenstein.app.Dictionary} dictionary input dictionary for stacking.
*/
frankenstein.app.Stacker = function(dictionary) {
/** @private */ this._dictionary = dictionary;
};
有人可以解釋為什么this._dictionary必須沒有@private JsDoc? 謝謝!
Closure Linter旨在強制執行Google JavaScript樣式指南 。 JSDoc標記@private
記錄如下:
與方法或屬性名稱上的尾部下划線結合使用,以指示該成員是私有的。 隨着工具更新以強制執行
@private
最終可能會棄用尾隨下划線。
從Closure Linter版本2.3.6開始,只要成員注釋@private
而沒有尾隨下划線,就會發出錯誤“Member <name>必須沒有@private JsDoc”。
此代碼不會發出任何錯誤或警告。
/**
* Stacker class.
* @constructor
* @param {frankenstein.app.Dictionary} dictionary Input dictionary for
* stacking.
*/
frankenstein.app.Stacker = function(dictionary) {
/** @private */ this.dictionary_ = dictionary;
};
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.