我有一个JSON编辑器,它可以正常工作,但是ESlint不断给我这个错误
'JSONEditor'未定义
我的代码存在于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不满意。
答案 0 :(得分:1)
ESLint对您的代码中该类的存在一无所知。 您可以跳过它或将其从代码中注释掉,或将其添加到异常中
答案 1 :(得分:1)
我添加了这一行,它解决了问题
/* global JSONEditor */