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

Oliver Hunt oliver at apple.com
Wed Sep 8 15:19:32 PDT 2010

The other problem with JSLint is that it can't run all of the code so JSLint won't pick up the runtime error in

function f() {
    "use strict";
    return this.foo;


I've seen a couple of sites that would break due to this.


On Sep 8, 2010, at 3:16 PM, Marek Stępień wrote:

> 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ń
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

More information about the es-discuss mailing list