2013-03-04 79 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