Browse Source

Update the style guide

JC Brand 3 years ago
parent
commit
cd1c6a4d23
1 changed files with 20 additions and 1 deletions
  1. 20 1
      docs/source/style_guide.rst

+ 20 - 1
docs/source/style_guide.rst

@@ -11,7 +11,7 @@ Most of the style guide recommendations here come from Douglas Crockford's book
 Tabs or spaces?
 ---------------
 
-We always indent 4 spaces. Proper indentation is important for readability.
+We always indent 4 spaces.
 
 Underscores or camelCase?
 -------------------------
@@ -27,6 +27,12 @@ For example:
         ...
     }
 
+const versus let
+----------------
+
+Try to use `const` whenever possible. If a variable won't be reassigned, use
+`const`, otherwise use `let`.
+
 Spaces around operators
 -----------------------
 
@@ -51,6 +57,19 @@ An exception is when they appear inside for-loop expressions, for example:
 Generally though, rather err on the side of adding spaces, since they make the
 code much more readable.
 
+destructuring
+-------------
+
+When assigning to a variable via destructuring, add spaces between the curly
+brackets.
+
+For example:
+
+.. code-block:: javascript
+
+    const { foo } = bar;
+
+
 Global constants are written in ALL_CAPS
 ----------------------------------------