JSLint is suddenly reporting: Use the function form of "use strict" JSLint is suddenly reporting: Use the function form of "use strict" javascript javascript

JSLint is suddenly reporting: Use the function form of "use strict"


Include 'use strict'; as the first statement in a wrapping function, so it only affects that function. This prevents problems when concatenating scripts that aren't strict.

See Douglas Crockford's latest blog post Strict Mode Is Coming To Town.

Example from that post:

(function () {   'use strict';   // this function is strict...}());(function () {   // but this function is sloppy...}());

Update:In case you don't want to wrap in immediate function (e.g. it is a node module), then you can disable the warning.

For JSLint (per Zhami):

/*jslint node: true */

For JSHint:

/*jshint strict:false */

or (per Laith Shadeed)

/* jshint -W097 */

To disable any arbitrary warning from JSHint, check the map in JSHint source code (details in docs).

Update 2: JSHint supports node:boolean option. See .jshintrc at github.

/* jshint node: true */


If you're writing modules for NodeJS, they are already encapsulated. Tell JSLint that you've got node by including at the top of your file:

/*jslint node: true */


I'd suggest to use jshint instead.

It allows to suppress this warning via /*jshint globalstrict: true*/.

If you are writing a library, I would only suggest using global strict if your code is encapsulated into modules as is the case with nodejs.

Otherwise you'd force everyone who is using your library into strict mode.