我有这个 javascript:
(function ($) {
// a comment
})(window.jQuery);
命令:
%systemroot%\system32\cscript.exe
论据:
//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)
($(ItemPath)
替换为 Visual Studio 中的当前选定项)
...它给了我这个输出:
[%pathname%\js\JScript1.js]
Line 3 character 18: Object doesn't support this property or method
Implied globals:
window: 3
我尝试将括号安排为使用JSLint样式,但这给了我同样的错误:
(function ($) {
// a comment
}(window.jQuery));
我的 javascript 做错了什么还是 JSHint 错误?
更新:我倾向于 JSHint 错误,这个 javascript:
(function ($) {
// a comment
})(window.jQuery);
// is this a bug?
window.alert("maybe?");
给我这个错误:
Line 5 character 23: Object doesn't support this property or method
更新#2:我认为这是将 args 传递给的正确方法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)
但是,这段代码:
(function (w, $) {})(window, jQuery);
仍然输出:
[%pathname%\js\JScript1.js]
Line 1 character 37: Object doesn't support this property or method
更新#3:事实证明,我确实是个白痴。
我试图使用最新的: https ://nodeload.github.com/jshint/jshint/zipball/master
...当我应该使用r09时: https ://nodeload.github.com/jshint/jshint/zipball/r09