Changelog
- Enforce curlies on
if...else
statements with thecurly
rule
This patch aims to remove the need for reviewing shorthand if
conditions. I am sure that we all have encountered this in code reviews quite a few times. This seems to fit our linter rules given the style guide making mention of always bracing if
statements.
The way we enforce this is using the curly ESLint rule set as error
.
Example
Writing code like the following
if (vimIsGreat) return true
Will emit the following error from ESLint
/Users/jorb/Code/neo/prequalification-service/src/domain/providers/jwt-validation/jwt-validation.provider.adapter.ts
13:15 error Expected { after 'if' condition curly
✖ 1 problem (1 error, 0 warnings)
1 error and 0 warnings potentially fixable with the `--fix` option.
Prompting the dev to write
if (vimIsGreat) {
return true
}
\(^▽^)/