簡體   English   中英

如何解決這個錯誤 JSONEditor is not defined ESlint

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM