Skip to content

Commit

Permalink
Ensure braces are always added for blocks
Browse files Browse the repository at this point in the history
Code such as `if (foo) foo++;` may seem safe at first but when
nested among other code, especially other conditionals, or complex
expressions, it can become very difficult to scan, leading to
misinterpretation of the code, bugs when editing, etc.

Ensuring consistent use of braces for blocks avoids unintended
changes in behaviour when adding additional statements to the block
as well as encouraging clearer formatting that makes the code easier
to scan. Seeing clusters of braces also serves as an indication to
developers that code complexity may be increasing and is something
that should be addressed.
  • Loading branch information
AlanGreene authored and tekton-robot committed Jun 24, 2019
1 parent 1ba3c93 commit fbb5504
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Expand Up @@ -26,6 +26,7 @@ module.exports = {
"react"
],
"rules": {
"curly": ["error", "all"],
"import/prefer-default-export": "off",
"jsx-a11y/anchor-is-valid": "off",
"no-case-declarations": "off",
Expand Down

0 comments on commit fbb5504

Please sign in to comment.