Skip to content

emptyFunctions

Reports empty functions that should contain code or a comment.

✅ This rule is included in the ts stylistic and stylisticStrict presets.

Empty functions can reduce readability because readers need to guess whether it’s intentional or not. If a function is intentionally empty, adding a comment makes the intention clear.

function
function foo(): void
foo
() {}
const
const foo: () => void
foo
= function () {};
const
const foo: () => void
foo
= () => {};
class
class Foo
Foo
{
Foo.bar(): void
bar
() {}
}
class
class Foo
Foo
{
constructor() {}
}

This rule is not configurable.

If you prefer to allow empty functions without comments, you may disable this rule. Some codebases use empty functions as no-ops or placeholders intentionally.

Made with ❤️‍🔥 around the world by the Flint team and contributors.