我使用 nicEdit 编辑器,它有一个名为 nicEditor
的函数对象。
JSLint 对其发出警告:
A constructor name 'nicEditor' should start with an uppercase letter.
它忽略了我放在问题行之前的 /*jslint newcap:false */
选项”
/*jslint newcap:false */
var nic_editor = new nicEditor({
buttonList : ['bold', 'italic', 'underline', 'strikethrough', 'emoticonToolbar'],
iconsPath : '/assets/nicEditorIcons.gif'
}),
/*jslint newcap:true */
我怎样才能抑制这个警告,但只针对这一行?
最佳答案
我不相信它可能比你现在更精细。 TBH,我认为您当前的解决方案很好。
如果你真的想避免 newCaps
设置,你可以只使用一个局部变量来重命名构造函数:
var NicEditor = nicEditor;
var nic_editor = new NicEditor({
buttonList : ['bold', 'italic', 'underline', 'strikethrough', 'emoticonToolbar'],
iconsPath : '/assets/nicEditorIcons.gif'
}),
关于javascript - 如何抑制单行的 JSLint 警告?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15206115/