You have to tell jshint which object and/or functions are considered global in the jshint tag comment at the top of your code. jsHint doesn't assume any, since they vary depending on the precise environment in which the code is run.
The approach I use is to tell jshint that the window
object itself is global (and a few others) with the following, and an ES5 strict-mode directive thrown in too:
/*global $ document window localStorage */
"use strict";
Silencing the warning about setInterval
then requires prefixing that function call with window.
- I like having to explicitly tag the global functions I'm using so I don't consider this a disadvantage.