![](/img/trans.png)
[英]How to convert for of loop into a for loop to solve the ESLint error
[英]How to solve this error JSONEditor is not defined ESlint
我有一个 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 对此不满意。
ESLint 不知道您的代码中是否存在该类。 您可以跳过它或将其从代码中注释掉或将其添加到异常中
我添加了这一行,它解决了问题
/* global JSONEditor */
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.