我使用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 */
Run Code Online (Sandbox Code Playgroud)
我怎样才能抑制此警告,但仅适用于此行?
我不相信它可能比你现在更精细.和TBH,我认为你目前的解决方案很好.
如果你真的想避免newCaps
设置,你可以使用局部变量来重命名构造函数:
var NicEditor = nicEditor;
var nic_editor = new NicEditor({
buttonList : ['bold', 'italic', 'underline', 'strikethrough', 'emoticonToolbar'],
iconsPath : '/assets/nicEditorIcons.gif'
}),
Run Code Online (Sandbox Code Playgroud)