5

我使用 nicEdit 编辑器,它有一个名为nicEditor.

JSLint 对它发出警告:

构造函数名称“nicEditor”应以大写字母开头。

它忽略了 /*jslint newcap:false */我在问题线之前放置的选项”

/*jslint newcap:false */
var nic_editor = new nicEditor({
    buttonList : ['bold', 'italic', 'underline', 'strikethrough', 'emoticonToolbar'],
    iconsPath : '/assets/nicEditorIcons.gif'
}),
/*jslint newcap:true */

我怎样才能抑制这个警告,但只针对这一行?

4

1 回答 1

5

我不相信它可能比你现在更细。TBH,我认为您当前的解决方案很好。

如果您真的想避免newCaps设置,您可以使用局部变量来重命名构造函数:

var NicEditor = nicEditor;
var nic_editor = new NicEditor({
    buttonList : ['bold', 'italic', 'underline', 'strikethrough', 'emoticonToolbar'],
    iconsPath : '/assets/nicEditorIcons.gif'
}),
于 2013-03-04T16:44:45.827 回答