admin管理员组

文章数量:1415111

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?

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?

Share Improve this question edited Mar 4, 2013 at 16:40 James Allardice 166k22 gold badges334 silver badges315 bronze badges asked Mar 4, 2013 at 16:22 zubazuba 1,5081 gold badge19 silver badges50 bronze badges 2
  • Can you switch to JSHint instead? This kind of thing is much easier with that. – James Allardice Commented Mar 4, 2013 at 16:42
  • I don't think I can switch easily 'cause I use JSLint through hallettj/jslint.vim Vim plugin. – zuba Commented Mar 4, 2013 at 17:31
Add a ment  | 

1 Answer 1

Reset to default 6

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'
}),

本文标签: javascriptHow can I suppress a JSLint warning for a single lineStack Overflow