如何解决此错误JSONEditor未定义ESlint

问题描述 投票:-1回答:2

我有一个JSON编辑器,它可以正常工作,但ESlint不断给我这个错误

'JS​​ONEditor'未定义

我的代码存在于angularJS 1.7组件中。

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

没什么复杂的,只有ESLint不满意。

javascript angularjs eslint
2个回答
1
投票

ESLint对您的代码中类的存在一无所知。您可以跳过它或将其从代码中注释掉,或将其添加到例外中


0
投票

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

/* global JSONEditor */
© www.soinside.com 2019 - 2024. All rights reserved.