ni / javascript-styleguide

JavaScript and TypeScript Style Guide
MIT License
9 stars 9 forks source link

Require curly braces for all blocks #105

Closed jattasNI closed 1 year ago

jattasNI commented 1 year ago

Justification

Fixes #86.

Implementation

Enable the brace-style and curly ESLint rules to match the decision described in the issue linked above. Now braces need to be present and the body must be on a new line:

// allowed
if (foo) {
    doSomething();
}

// disallowed
if (foo) { doSomething(); }
if (foo) doSomething();
if (foo) 
    doSomething();

Testing

Manually modified test files within the repo and verified that lint errors are reported for both JS and TS code if you have an if without braces.