为什么"会员不得拥有@private JsDoc"?

J. *_*ein 3 javascript google-closure google-closure-library gjslint

我正在使用Google Closure Tools中的gjslint工具清理我的代码.它报告以下错误:

Line 15, E:0222: Member "this._dictionary" must not have @private JsDoc
Run Code Online (Sandbox Code Playgroud)

这是代码:

/**
 * Stacker class.
 * @constructor
 * @param {frankenstein.app.Dictionary} dictionary input dictionary for stacking.
 */
frankenstein.app.Stacker = function(dictionary) {
  /** @private */ this._dictionary = dictionary;
};
Run Code Online (Sandbox Code Playgroud)

有人可以解释为什么this._dictionary必须没有@private JsDoc?谢谢!

Chr*_*ert 7

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;
};
Run Code Online (Sandbox Code Playgroud)