<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>On 19/10/2017 03:29, Kris Maglione wrote:<br>
</p>
<blockquote type="cite"
cite="mid:20171019022929.GB1889@kmag.localdomain">On Wed, Oct 18,
2017 at 07:22:09PM -0700, Daniel Veditz wrote:
<br>
<blockquote type="cite">On Wed, Oct 18, 2017 at 4:51 AM, Mark
Banner <a class="moz-txt-link-rfc2396E" href="mailto:mbanner@mozilla.com"><mbanner@mozilla.com></a> wrote:
<br>
<br>
<blockquote type="cite">I did an experiment, and the only way I
got an error out was to have
<br>
"javascript.options.strict" on and
<br>
<br>
</blockquote>
<br>
Why isn't it a code-style/review requirement that our own
internal JS
<br>
include "use strict"? As a quick check I found 659 .jsm files in
our tree
<br>
and only about 500 with "use strict". A quick skim of .js files
shows a
<br>
similar ratio. It's not terrible (call it a "B" grade?) but we
could do
<br>
better.
<br>
</blockquote>
<br>
It is, in some areas, depending on their ESLint rules:
<br>
<br>
<a class="moz-txt-link-freetext" href="http://searchfox.org/mozilla-central/search?q=%22strict%22&case=true®exp=false&path=eslint">http://searchfox.org/mozilla-central/search?q=%22strict%22&case=true®exp=false&path=eslint</a>
<br>
</blockquote>
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.<br>
<blockquote type="cite"
cite="mid:20171019022929.GB1889@kmag.localdomain">
And it's automatically enforced everywhere in JSM and JS component
code.</blockquote>
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.<br>
<blockquote type="cite"
cite="mid:20171019022929.GB1889@kmag.localdomain">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.
<br>
</blockquote>
Side note: fyi, we recently enabled the <a moz-do-not-send="true"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=1392119">no-caller
rule</a> 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 <a
moz-do-not-send="true"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=1357557">we're
working on</a>).<br>
<br>
Mark<br>
</body>
</html>