"use strict"; prepended blindly to scripts in the wild

Marek Stępień marcoos+es at marcoos.org
Wed Sep 8 15:16:52 PDT 2010


On Tue, Sep 7, 2010 at 7:21 PM, Brendan Eich <brendan at mozilla.com> wrote:
> Anyone know of bad advice somewhere, or a code generator doing the prepending,
> or anything else we should evangelize aggressively either to stop pasting "use strict";
> blindly, or do do the testing to make sure the code passes in a conforming ES5
> implementation

JSLint.com (which is an awesome tool that I use pretty much every day)
tells you to add "use strict" if you choose the "Good Parts" option.
Its documentation says to "use it wisely", but people don't usually
read the docs.

Maybe JSLint should be fixed to disallow non-strict code with "use
strict;". The following code is said to be OK by JSLint with "Good
Parts" at the moment:

/*global window */
"use strict";

function someFun() {
    window.alert(arguments.callee);
}

someFun();

I'm not sure whether people often run concatenated scripts through
tools like JSLint, though. So maybe it should also warn you not to
concatenate scripts blindly...

PS. I already wrote most of the above in the Intel bug in Mozilla's
Bugzilla, but now I think posting it here makes more sense.

-- 
Marek Stępień


More information about the es-discuss mailing list