Remove old hack 'src/vendor/codemirror/addon/lint/json-lint'

This commit is contained in:
orangemug 2020-03-08 18:43:46 +00:00
parent ce976991d4
commit 1c953bc296
2 changed files with 0 additions and 34 deletions

View file

@ -15,9 +15,6 @@ import jsonlint from 'jsonlint'
import stringifyPretty from 'json-stringify-pretty-compact'
import '../util/codemirror-mgl';
// This is mainly because of this issue <https://github.com/zaach/jsonlint/issues/57> also the API has changed, see comment in file
import '../../vendor/codemirror/addon/lint/json-lint'
class JSONEditor extends React.Component {
static propTypes = {

View file

@ -1,31 +0,0 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
// Depends on fork of jsonlint from <https://github.com/josdejong/jsonlint>
// becuase of <https://github.com/zaach/jsonlint/issues/57>
var jsonlint = require("jsonlint");
var CodeMirror = require("codemirror");
CodeMirror.registerHelper("lint", "json", function(text) {
var found = [];
// NOTE: This was modified from the original to remove the global, also the
// old jsonlint API was 'jsonlint.parseError' its now
// 'jsonlint.parser.parseError'
jsonlint.parser.parseError = function(str, hash) {
var loc = hash.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);
}
catch(e) {
// Do nothing we catch the error above
}
return found;
});