gpt4 book ai didi

javascript - 如何抑制单行的 JSLint 警告?

转载 作者:搜寻专家 更新时间:2023-11-01 04:10:00 25 4
gpt4 key购买 nike

我使用 nicEdit 编辑器,它有一个名为 nicEditor 的函数对象。

JSLint 对其发出警告:

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

它忽略了我放在问题行之前的 /*jslint newcap:false */ 选项”

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

我怎样才能抑制这个警告,但只针对这一行?

最佳答案

我不相信它可能比你现在更精细。 TBH,我认为您当前的解决方案很好。

如果你真的想避免 newCaps 设置,你可以只使用一个局部变量来重命名构造函数:

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

关于javascript - 如何抑制单行的 JSLint 警告?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15206115/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com