[英]how to fix eslint error 'pendo is not defined' in my react application
I'm trying to add pendo snippet in my react application I have included the javascript snippet and I use pendo.initialize({visitor:{id:'id'})
I validate using pendo.validateInstall()
, all works fine but I've encountered a eslint error "pendo is not defined" in pendo.initialize({visitor:{id:'id'})
which is used at my promise handler.我正在尝试在我的反应应用程序中添加 pendo 片段我已经包含了 javascript 片段,我使用
pendo.initialize({visitor:{id:'id'})
我使用pendo.validateInstall()
进行验证,一切正常,但我在我的承诺处理程序中使用的pendo.initialize({visitor:{id:'id'})
中遇到了 eslint 错误“pendo 未定义”。
You can add globals in the eslint
configuration.您可以在
eslint
配置中添加全局变量。
"globals": {
"pendo": true
}
If you want to override the error message just in one file, you add the following on top of your javascript file.如果您只想在一个文件中覆盖错误消息,请在 javascript 文件顶部添加以下内容。
/* global pendo */
Checkout the eslint global documentation .查看 eslint 全局文档。
Instead of using而不是使用
pendo.initialize({visitor:{id:'id'})
use用
window.pendo.initialize({visitor:{id:'id'})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.