How can I suppress a JSLint warning for a single line?

I am using the nicEdit editor, which has a function object nicEditor.

JSLint puts a warning on it:

The constructor name 'nicEditor' must begin with a capital letter.

It ignores the parameter /*jslint newcap:false */that I set right in front of the problem line

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

How can I suppress this warning, but only for this line?

+5
source share
1 answer

I do not think that it can be smaller than you are now. And TBH, I think your current solution is just fine.

If you really want to avoid installation newCaps, you can simply use a local variable to rename the constructor:

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

All Articles