I have this javascript:
(function ($) {
// a comment
})(window.jQuery);
I’m running the wsh version of JSHint with these options:
Command:
%systemroot%\system32\cscript.exe
Arguments:
//Nologo "%userprofile%\Documents\jshint\env\wsh.js" /forin:true,noarg:true,noempty:true,eqeqeq:true,bitwise:true,undef:true,unused:true,browser:true,jquery:true,indent:4,maxerr:500 $(ItemPath)
(The $(ItemPath) is replaced by the current selected item in Visual Studio)
…And it’s giving me this output:
[%pathname%\js\JScript1.js]
Line 3 character 18: Object doesn't support this property or method
Implied globals:
window: 3
I’ve tried arranging the parens to use JSLint style, but that gives me the same error:
(function ($) {
// a comment
}(window.jQuery));
Am I doing something wrong with my javascript or is this a JSHint bug?
Update: I’m leaning towards JSHint bug, this javascript:
(function ($) {
// a comment
})(window.jQuery);
// is this a bug?
window.alert("maybe?");
Gives me this error:
Line 5 character 23: Object doesn't support this property or method
Update #2: I think that this is the correct way to pass in args to wsh.js:
//U //Nologo "%userprofile%\Documents\jshint\env\wsh.js" /forin:true /noarg:true /noempty:true /eqeqeq:true /bitwise:true /undef:true /unused:true /browser:true /jquery:true /indent:4 /maxerr:500 $(ItemPath)
However, this code:
(function (w, $) {})(window, jQuery);
Still outputs this:
[%pathname%\js\JScript1.js]
Line 1 character 37: Object doesn't support this property or method
Update #3: It turns out, I am indeed an idiot.
I was trying to use the latest:
https://nodeload.github.com/jshint/jshint/zipball/master
…When I should have been using r09:
https://nodeload.github.com/jshint/jshint/zipball/r09
So this was a bug in latest master and it’s been fixed for the r10 release: http://www.jshint.com/changelog/