Jasmine and JSLint: variable used before being declared

In the driving-me-nuts category…

Using Brackets to create and edit my Jasmine and JavaScript pieces has been going well. We also have the satisfaction of knowing that JsLint is by default checking that we are being as tidy as we can with JavaScript. For example:


Fix that:


Schweet: no more JSLint error.

If we now look at that in the Jasmine context…


Apart from [Calc2], all of these are part of the Jasmine framework. Googling various combinations of Jasmine, JSLint, JSHint, globals, etc, yielded nothing in answers that meant anything to me, and that actually worked for me. What am I actually looking for? A setting either in the Brackets settings json file, or a jshint or jslint settings file that says: “this set? ignore any global / early definition errors.” Sure I’m a noob to JS, and if I knew more I would know how to sort that. Right now I don’t know, so I’m reverting to what feels like a hack… possibly because this wouldn’t be allowed in the strongly typed world without assignment at the same time:

  • var expect, it, describe, beforeEach, afterEach;
  • var Calc2;


With that in place, a) there are no JSLint errors, and b) the test still runs OK:


PasteBin here here