The Firefox remote protocol in testing/marionette predominantly uses
camel casing in naming properties and variables. To enforce consistency
with this practice, this patch adds an eslint rule to enforce camel case.
There are a few exceptions where we use snake case in response output.
We can disable the lint rule on an individual basis in this handful
of cases.
MozReview-Commit-ID: DL7msdriFil
--HG--
extra : rebase_source : 737791b59002027f7501e7c46bd31d7a368a9b66
We recently had a serious bug in Marionette (https://bugzil.la/1254136)
due to a case statement that fell through due to a missing "break"
statement. This patch introduces a lint rule to prevent similar episodes
in the future.
When you do want a case to fall through, it is possible to add a comment
like this:
switch (foo) {
case 1:
doSomething();
// fall through
case 2:
doSomething();
break;
}
MozReview-Commit-ID: Gu8cFGsdne2
--HG--
extra : rebase_source : 8b29c663167783770d0eb0a32b7a7c2cb83a529e
Under testing/marionette, we always use semicolons for consistency and we
never initialise scoped variables to undefined becuase it is the default
value. We also indent continued call expressions by four characters.
Disallowed:
let foo = undefined;
return foo
Allowed:
const foo = undefined;
let bar;
return bar;
MozReview-Commit-ID: LgVPMqnFqNk
The eslint rules are based on the default, non-opinionated eslint rules
used throughout mozilla-central. The testing/marionette eslint rules
are a specialisation of these based on the current coding style used.
These should not be contradictory to the overall JS code style that can
be inferred from the existing code base.
MozReview-Commit-ID: 2rKabgXXnu4
--HG--
extra : rebase_source : 724544b60b71db7c7b093a1ed51ebc77bc66482d