Skip to content

Commit

Permalink
show liniting syntax errors
Browse files Browse the repository at this point in the history
SQUASHED: AUTO-COMMIT-demos-javascript-double-import.js,AUTO-COMMIT-src-external-eslint-eslint-lint.js,
  • Loading branch information
JensLincke committed May 21, 2024
1 parent 5ebdb77 commit f482e52
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions demos/javascript/double-import.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {value} from "./a.js"
import {value} from "./a.js"


var foo =3
Expand Down
4 changes: 3 additions & 1 deletion src/external/eslint/eslint-lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ import {parse} from "./eslint-parser.js";
var error = errors[i];
result.push({message: error.message,
severity: getSeverity(error),
from: getPos(error, true),
from: getPos(error, true) ,
to: getPos(error, false)});
}
return result;
Expand All @@ -352,6 +352,8 @@ import {parse} from "./eslint-parser.js";
CodeMirror.registerHelper("lint", "javascript", validator);

function getPos(error, from) {
if (error.line === undefined) return CodeMirror.Pos(0, 0)

var line = error.line-1, ch = from ? error.column : error.column+1;
if (error.node && error.node.loc) {
line = from ? error.node.loc.start.line -1 : error.node.loc.end.line -1;
Expand Down

0 comments on commit f482e52

Please sign in to comment.