Skip to content

v0.6.4

Latest
Compare
Choose a tag to compare
@jordanbrauer jordanbrauer released this 27 Feb 21:17
· 11 commits to master since this release
c7ed7aa

Changelog

  • Enforce curlies on if...else statements with the curly 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
}

\(^▽^)/