Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function doLint(data, options, globals, lineOffset, charOffset) {
// Lint the code and write readable error output to the console.
try {
jshint(data, options, globals);
} catch (e) {}
jshint.errors
.sort(function(first, second) {
first = first || {};
second = second || {};
if (!first.line) {
return 1;
} else if (!second.line){
return -1;
} else if (first.line == second.line) {
return +first.character < +second.character ? -1 : 1;
} else {
return +first.line < +second.line ? -1 : 1;
}