UNPKG

choerodon-ui

Version:

An enterprise-class UI design language and React-based implementation

32 lines (23 loc) 829 B
import jsonlintMod from 'jsonlint-mod'; if (typeof window !== 'undefined') { require('codemirror/addon/lint/lint.css'); require('codemirror/addon/lint/lint'); // eslint-disable-next-line @typescript-eslint/no-var-requires var CodeMirror = require('codemirror'); CodeMirror.registerHelper('lint', 'json', function (text) { var found = []; var jsonlint = jsonlintMod.parser || jsonlintMod; jsonlint.parseError = function (str, _ref) { var loc = _ref.loc; found.push({ from: CodeMirror.Pos(loc.first_line - 1, loc.first_column), to: CodeMirror.Pos(loc.last_line - 1, loc.last_column), message: str }); }; try { jsonlint.parse(text); // eslint-disable-next-line no-empty } catch (e) {} return found; }); } //# sourceMappingURL=json.js.map