Commit 9bf37b0f authored by Coung Ngo's avatar Coung Ngo

Add conditional statement section to FE style guide

Added a section to the FE style guide to suggest
avoidance of single line conditional statements
for code readability
parent 42eddfb0
......@@ -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).
......
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