简体   繁体   中英

How to solve this error JSONEditor is not defined ESlint

I have a JSON Editor and it works correctly but ESlint keeps giving me this error

'JSONEditor' is not defined

My code exists inside an angularJS 1.7 component.

this.$onInit = function () {
    var container = $document[0].getElementById('jsoneditor');
    var editor = new JSONEditor(container, { mode: 'code' }, json);
    // code to use the editor 
};

Nothing complicated only ESLint not happy with it.

ESLint does not know anything about the existence of the class within your code. You can just skip it or comment it out of your code or add it to exceptions

我添加了这一行,它解决了问题

/* global JSONEditor */

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