eslint/no-empty-function Restriction β
What it does β
Disallows the usages of empty functions
Why is this bad? β
Empty functions can reduce readability because readers need to guess whether itβs intentional or not. So writing a clear comment for empty functions is a good practice.
Example β
Examples of incorrect code for this rule:
javascript
function foo() {}
const bar = () => {};
Examples of correct code for this rule:
javascript
function foo() {
// do nothing
}
function foo() {
return;
}
const add = (a, b) => a + b;