2013-03-04 78 views
5

我使用nicEdit编辑器,它有一个名为nicEditor的函数对象。我该如何为单行压缩JSLint警告?

的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 */ 

之前摆正我怎么能禁止这种警告,但只有这条线?

+0

可以切换到JSHint吗?这样的事情更容易。 – 2013-03-04 16:42:01

+0

我不认为我可以轻松切换,因为我通过hallettj/jslint.vim Vim插件使用JSLint。 – zuba 2013-03-04 17:31:35

回答

5

我不相信它可能TBH,我认为你现在的解决方案很好

如果你真的想要避免newCaps设置,你可以使用一个lo cal变量来重命名构造函数:

var NicEditor = nicEditor; 
var nic_editor = new NicEditor({ 
    buttonList : ['bold', 'italic', 'underline', 'strikethrough', 'emoticonToolbar'], 
    iconsPath : '/assets/nicEditorIcons.gif' 
}), 
+0

就是这样!谢谢,missno – zuba 2013-03-04 17:35:13