Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-28 18:09:13 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-28 18:09:13 +0300
commit736d36d8597d0d1ec1b47644e6d091c3f4a78f45 (patch)
treea38f6fef2b7147416b31f8294a9389b3bb472c87 /doc/development/fe_guide
parent5426ca9908085087d465fa52800335f408eb965a (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/development/fe_guide')
-rw-r--r--doc/development/fe_guide/style/javascript.md15
1 files changed, 15 insertions, 0 deletions
diff --git a/doc/development/fe_guide/style/javascript.md b/doc/development/fe_guide/style/javascript.md
index f40e8c7b5df..7951c702601 100644
--- a/doc/development/fe_guide/style/javascript.md
+++ b/doc/development/fe_guide/style/javascript.md
@@ -175,6 +175,21 @@ are loaded dynamically with webpack.
Do not use `innerHTML`, `append()` or `html()` to set content. It opens up too many
vulnerabilities.
+## Avoid single-line conditional statements
+
+Indentation is important when scanning code as it gives a quick indication of the existence of branches, loops, and return points.
+This can help to quickly understand the control flow.
+
+```javascript
+// bad
+if (isThingNull) return '';
+
+// good
+if (isThingNull) {
+ return '';
+}
+```
+
## ESLint
ESLint behaviour can be found in our [tooling guide](../tooling.md).