Skip to content

Files

Latest commit

 

History

History
24 lines (16 loc) · 761 Bytes

no_empty_functions.md

File metadata and controls

24 lines (16 loc) · 761 Bytes

Pattern: Empty function

Issue: -

Description

Disallows declaring empty functions. The goal of this rule is that unintentional empty callbacks can be detected:

someFunctionWithCallback ->
doSomethingSignificant()

The problem is that the call to doSomethingSignificant will be made regardless of someFunctionWithCallback's execution. It can be because you did not indent the call to doSomethingSignificant properly. If you really meant that someFunctionWithCallback should call a callback that does nothing, you can write your code this way:

someFunctionWithCallback ->
    undefined
doSomethingSignificant()

Further Reading