Javascript JSHint对象在外部文件中定义时未定义
我在文件remover.js中有以下对象:Javascript JSHint对象在外部文件中定义时未定义,javascript,jshint,Javascript,Jshint,我在文件remover.js中有以下对象: 'use strict'; (function( remover, $, undefined ) { // ... // Object's definition // ... }( window.remover = window.remover || {}, jQuery )); 'use strict'; remover.doSomething(); 这用于外部文件main.js: 'use strict'; (function
'use strict';
(function( remover, $, undefined ) {
// ...
// Object's definition
// ...
}( window.remover = window.remover || {}, jQuery ));
'use strict';
remover.doSomething();
这用于外部文件main.js:
'use strict';
(function( remover, $, undefined ) {
// ...
// Object's definition
// ...
}( window.remover = window.remover || {}, jQuery ));
'use strict';
remover.doSomething();
代码正在运行,但JSHint引发以下问题:
Running "jshint:all" (jshint) task
app/scripts/stuff/main.js
line 3 col 1 'remover' is not defined.
✖ 1 problem
如何删除此警告?您有两个选择,一个是使用所有未定义的警告,这对调试不利,另一个是专门解决全局实体的问题
grunt jshint
应该输出:
Running "jshint:all" (jshint) task
✔ No problems
在中的指令部分有更多信息