raszi / node-tmp

Temporary file and directory creator for node.js
MIT License
736 stars 92 forks source link

Code style #244

Closed silkentrance closed 4 years ago

silkentrance commented 4 years ago

The existing code style with if/then and other such constructs such as multiple returns per function/method is counter intuitive and prone to error and thus not up to par with what one would call clean code standard, when done properly.

So we need to enforce a single exit point per function/method where possible and also make sure that all for/do/while/if/then/else/try/catch/finally clauses are discriminated by opening and closing curly brackets, always.

raszi commented 4 years ago

I agree with the proposal and to use a consistent style that's why the eslint was introduced.

Although I do not agree with the single exit point per function proposal, I believe that puts a bigger cognitive load on the reader. I would rather focus on the length of the functions and break down the overgrown ones to smaller and then compose them.

silkentrance commented 4 years ago

Closing as the existing eslint options are sufficient.