[Sugar-devel] Sugar Web, use strict mode?

Manuel Quiñones manuq at laptop.org
Tue Nov 19 11:41:34 EST 2013


2013/11/19 Code Raguet <ignacio.code at gmail.com>:
>
> On Tue, Nov 19, 2013 at 12:45 PM, Manuel Quiñones <manuq at laptop.org> wrote:
>>
>> If we agree, I will add it to all our codebase and see what happens.
>
>
> +1, I think it's a good practice.
> And I will help with this when sending patches.
>
> If you are going to migrate non-strict the 'Use the function form of "use
> strict".' hint from JSHint may be a nice hint.
> It prevents issues we concatenating strict code with non-strict code.

We don't concatenate or minify code, but is good to do the change globally.

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

Good point.  Seems that adding it inside the requirejs function that
defines the module is fine for JSHint:

define([...], function (...) {
    'use strict';

    // module code here

});

Thanks for your insights.

-- 
.. manuq ..


More information about the Sugar-devel mailing list