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 foo() {}
const foo = function () {};
const foo = () => {};
class Foo {
bar() {}
}
class 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 ❤️‍🔥 in Boston by Josh Goldberg and contributors.