mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-11-10 07:47:46 +01:00
Remove old hack 'src/vendor/codemirror/addon/lint/json-lint'
This commit is contained in:
parent
ce976991d4
commit
1c953bc296
2 changed files with 0 additions and 34 deletions
|
@ -15,9 +15,6 @@ import jsonlint from 'jsonlint'
|
||||||
import stringifyPretty from 'json-stringify-pretty-compact'
|
import stringifyPretty from 'json-stringify-pretty-compact'
|
||||||
import '../util/codemirror-mgl';
|
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 {
|
class JSONEditor extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
|
31
src/vendor/codemirror/addon/lint/json-lint.js
vendored
31
src/vendor/codemirror/addon/lint/json-lint.js
vendored
|
@ -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;
|
|
||||||
});
|
|
Loading…
Reference in a new issue