Reputation: 33
I tried to use jsHint on my project. But for me it doesn't work obviously. For example:
(function () {
if (!window.myApp) window.myApp = {};
var myApp = window.myApp;
var a = function (key) {
key = key || "key";
return myApp.someModule.get(key);
};
a();
})();
This chunk should throw error, something like that: "TypeError: myApp.someModule is undefined", but jsHint is still silent. I use default settings for jsHint from http://jshint.com/ . Can anybody help me? Thanks a lot.
Upvotes: 0
Views: 242
Reputation: 30092
Fairly sure that it only checks for variables in the "local" scope, it won't check all the way down objects chains. In fact I'd say it's impossible to be able to detect in all cases.
Consider:
var o = {};
someAjaxRequest({
callback: function(response) {
o[response.responseText] = 'found!';
}
});
Upvotes: 1