Commit 8fea7831 authored by Marcia Ramos's avatar Marcia Ramos

Merge branch 'cngo/add-conditional-statement-style-section' into 'master'

Add conditional statement section to FE style guide

See merge request gitlab-org/gitlab!25549
parents 02da389b 9bf37b0f
...@@ -175,6 +175,21 @@ are loaded dynamically with webpack. ...@@ -175,6 +175,21 @@ are loaded dynamically with webpack.
Do not use `innerHTML`, `append()` or `html()` to set content. It opens up too many Do not use `innerHTML`, `append()` or `html()` to set content. It opens up too many
vulnerabilities. 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
ESLint behaviour can be found in our [tooling guide](../tooling.md). ESLint behaviour can be found in our [tooling guide](../tooling.md).
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment