Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add 'scope' property to critical errors.

Critical errors (those produced by the 'quit' function) show up
in JSHINT.data() as well as any other errors and warnings and
should have the same format.

This patch adds a missing property 'scope' to such errors. It's
always set to '(main)' since errors are unrecoverable.

Fixes GH-714.
  • Loading branch information...
commit ee77638cb6448a8d233b69ab482a73dd24a788fc 1 parent 0cc6441
@valueof valueof authored
Showing with 10 additions and 3 deletions.
  1. +4 −3 src/stable/jshint.js
  2. +6 −0 tests/stable/unit/core.js
View
7 src/stable/jshint.js
@@ -4723,9 +4723,10 @@ loop:
if (e) {
var nt = nexttoken || {};
JSHINT.errors.push({
- raw : e.raw,
- reason : e.message,
- line : e.line || nt.line,
+ scope : "(main)",
+ raw : e.raw,
+ reason : e.message,
+ line : e.line || nt.line,
character : e.character || nt.from
}, null);
}
View
6 tests/stable/unit/core.js
@@ -340,6 +340,12 @@ exports.insideEval = function (test) {
.test(src, { evil: false });
+ // Regression test for bug GH-714.
+ JSHINT(src, { evil: false, maxerr: 1 });
+ var err = JSHINT.data().errors[1];
+ test.equal(err.raw, "Too many errors.");
+ test.equal(err.scope, "(main)");
+
test.done();
};
Please sign in to comment.
Something went wrong with that request. Please try again.