javascript - How can I suppress a JSLint warning for a single line? - Stack Overflow

I use nicEdit editor, which has a function object called nicEditor. JSLint puts a warning on it: A cons

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745200306a4616290.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信