Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I use nicEdit editor, which has a function object called nicEditor.

JSLint puts a warning on it:

A constructor name 'nicEditor' should start with an uppercase letter.

It ignores the /*jslint newcap:false */ option I put right before the troubled 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?

like image 478
zuba Avatar asked Mar 04 '13 16:03

zuba


1 Answers

I don't believe its possible to be more finegrained than you currently are. And TBH, I think your current solution is just fine.

If you really want to avoid the newCaps setting you could just 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'
}),
like image 50
hugomg Avatar answered Sep 24 '22 17:09

hugomg