我正在使用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吗?谢谢!
发布于 2012-07-25 12:19:46
Closure Linter旨在执行。JSDoc标签@private的文档如下所示:
与方法或属性名称上的尾部下划线一起使用,以指示该成员是私有成员。随着工具更新以强制执行
@private,尾随下划线可能最终会被弃用。
从Closure Linter版本2.3.6开始,只要成员被注释为@private而不带下划线,就会发出错误"Member 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;
};https://stackoverflow.com/questions/11642252
复制相似问题