简体   繁体   中英

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.

My screenshot is here

You can add globals in the eslint configuration.

"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.

/* global pendo */

Checkout the eslint global documentation .

Instead of using

pendo.initialize({visitor:{id:'id'})

use

window.pendo.initialize({visitor:{id:'id'})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM