On 19/10/2017 03:29, Kris Maglione wrote:

On Wed, Oct 18, 2017 at 07:22:09PM -0700, Daniel Veditz wrote:
On Wed, Oct 18, 2017 at 4:51 AM, Mark Banner <mban...@mozilla.com> wrote:

I did an experiment, and the only way I got an error out was to have
"javascript.options.strict" on and


Why isn't it a code-style/review requirement that our own internal JS
include "use strict"? As a quick check I found 659 .jsm files in our tree
and only about 500 with "use strict". A quick skim of .js files shows a
similar ratio. It's not terrible (call it a "B" grade?) but we could do
better.

It is, in some areas, depending on their ESLint rules:

http://searchfox.org/mozilla-central/search?q=%22strict%22&case=true&regexp=false&path=eslint
Requiring "use strict" globally for ESLint is one of the items I've already had a few discussions about. The rough current plan is to get ESLint upgraded to version 4 (there's been a few blockers on that), then think about enabling more rules. Some of the rules are overlapping with what strict mode enforces, so I think we can turn those on earlier, then enable use strict slightly later.
And it's automatically enforced everywhere in JSM and JS component code.
To clarify, the "use strict" at the start of those files is just for show/to remind developers? Once we get ESLint 4, we can quite easily enforce showing "use strict" for all .jsm files.
To date, we've mostly avoided enforcing it for browser window code to avoid breaking extensions that used arguments.callee.caller (despite my endorsement for breaking those extensions...), but that's not really an issue anymore, so we should probably move towards enforcing it for all chrome JS.
Side note: fyi, we recently enabled the no-caller rule <https://bugzilla.mozilla.org/show_bug.cgi?id=1392119> for ESLint which stops this being used. We haven't got 100% ESLint coverage yet, but I believe we've covered most production code and it is mainly tests remaining (which we're working on <https://bugzilla.mozilla.org/show_bug.cgi?id=1357557>).

Mark
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to