Disable "use the function form of use strict" but keep the "Missing 'use strict' statement" warning

Randall Flagg picture Randall Flagg · Jan 21, 2012 · Viewed 11k times · Source

I am using jslint to validate my code.
I have "use strict" on all my pages.
How can I disable the message "use the function form of 'use strict'" but keep the "Missing 'use strict' statement" warning, so I won't forget to put it on new files?

Thanks

Answer

Paul Armstrong picture Paul Armstrong · Jan 21, 2012

According to Crockford's post, you'll want to wrap everything in a function...

(function () {
    "use strict";
    // the rest of your file goes here...
}());

You could also use jshint instead, which has a "globalstrict" option that can do exactly what you're asking for without having to wrap everything in a function