"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];

var _jsonlintMod = _interopRequireDefault(require("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["default"].parser || _jsonlintMod["default"];

    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
