diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 69898f3d63..1975675dcc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -178,7 +178,7 @@ The following guidelines are provided for anyone contributing source code to the code, and present these in the following order: * First, variable declarations and initialization. * Secondly, imperative statements. - * Finally, the returned value. Functions should only have a single return statement. + * Finally, the returned value. A single return statement at the end of the function should be used, except where an early return would improve code clarity. 1. Avoid the use of "magic" values. eg. ```JavaScript @@ -189,7 +189,7 @@ The following guidelines are provided for anyone contributing source code to the ```JavaScript if (responseCode === 401) ``` -1. Don’t use the ternary operator. Yes it's terse, but there's probably a clearer way of writing it. +1. Use the ternary operator only for simple cases such as variable assignment. Nested ternaries should be avoided in all cases. 1. Test specs should reside alongside the source code they test, not in a separate directory. 1. Organize code by feature, not by type. eg.