Skip to content

Commit

Permalink
[[FIX]] Remove null value from errors array (#3049)
Browse files Browse the repository at this point in the history
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 f7eb3d7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/jshint.js
Original file line number Diff line number Diff line change
Expand Up @@ -5398,7 +5398,7 @@ var JSHINT = (function() {
reason : err.reason,
line : err.line || nt.line,
character : err.character || nt.from
}, null);
});
} else {
throw err;
}
Expand Down
4 changes: 1 addition & 3 deletions tests/helpers/testhelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f7eb3d7

Please sign in to comment.