From 38f206cb7288d8ef3f05e74e8201e9e662a0859a Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Fri, 17 Apr 2020 16:32:28 +0200 Subject: [docs] Update coding style cf. discussion with Tobin. --- docs/UXP Coding Style.md | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/docs/UXP Coding Style.md b/docs/UXP Coding Style.md index 5dc4fd2a5..fc025584f 100644 --- a/docs/UXP Coding Style.md +++ b/docs/UXP Coding Style.md @@ -126,7 +126,7 @@ switch (variable) { code_for_1; code_for_1; break; - case value2: + case value2: // Comment describing 2 (alternative) code_for_2; code_for_2; // fallthrough @@ -273,7 +273,7 @@ Applies to `*.js` and `*.jsm`. } }, false); ``` -- Use a single space between `{` `}` braces in empty js objects. +- Don't use a space between `{` `}` braces in empty js objects, `{` `}` braces in empty function scopes, or `[` `]` brackets in empty arrays. ### Flow control Flow control expressions should follow the following guidelines: @@ -343,7 +343,7 @@ switch (variable) { code_for_1; code_for_1; break; - case value2: + case value2: // Comment describing 2 (alternative) code_for_2; code_for_2; // fallthrough @@ -397,8 +397,7 @@ try { try { do_something(); -} catch(e) { -} +} catch(e) {} try { do_something(); @@ -414,11 +413,6 @@ try { // No error processing do_something_else(); } - -// No closing brace on its own line -try { - do_something(); -} catch(ex) { } ``` ### Long line wrapping -- cgit v1.2.3