Permalink
Browse files

[[FIX]] Remove `null` value from `errors` array (#3049)

When reporting unrecoverable errors, JSHint would insert two elements
into the global `errors` array: a descriptor for the error itself, and a
`null` value. Because this behavior is undocumented and inconsistent, it
is most likely the result of a programming error. Ensure that the
`JSHINT.errors` collection contains only error descriptor.
  • Loading branch information...
jugglinmike authored and rwaldron committed Oct 18, 2016
1 parent f62dcb7 commit f7eb3d7ae1c1eb4a2a9b631e75c676c61c5bd9ec
Showing with 2 additions and 4 deletions.
  1. +1 −1 src/jshint.js
  2. +1 −3 tests/helpers/testhelper.js
@@ -5398,7 +5398,7 @@ var JSHINT = (function() {
reason : err.reason,
line : err.line || nt.line,
character : err.character || nt.from
}, null);
});
} else {
throw err;
}
@@ -52,9 +52,7 @@ exports.setup.testRun = function (test, name) {

test: function (source, options, globals) {
var ret = !!JSHINT(source, options, globals);
var errors = JSHINT.errors.filter(function (er) {
return er;
});
var errors = JSHINT.errors;

if (errors.length === 0 && definedErrors.length === 0) {
return;

0 comments on commit f7eb3d7

Please sign in to comment.