Reputation: 1983
Using jshint, if you have something like:
var Thing = (function(){
"use strict";
// code and stuff...
}());
I get a "missing use strict" error on the last line. I suppose this is because the var Thing =
falls outside of the strict scope. Is there a way to prevent this warning without turning off the use strict warnings entirely?
Upvotes: 0
Views: 90
Reputation: 3930
In your .jshintrc, remove globalstrict: true
and use strict: true
http://jshint.com/docs/options/#strict
globalstrict
is for file scope 'use strict' and strict
is for fonction scope (the one you want).
Upvotes: 1
Reputation: 8715
You can use one more wrapper:
(function(namespace) {
'use strict';
namespace.Thing = (function() {
// code here
})();
})(window);
Upvotes: 1