close

no-empty-function

Configuration

rslint.config.ts
import { defineConfig, ts } from '@rslint/core';

export default defineConfig([
  ts.configs.recommended,
  {
    rules: {
      '@typescript-eslint/no-empty-function': 'error',
    },
  },
]);

Rule Details

Disallows empty functions. Empty functions can reduce readability because readers need to guess whether the empty body is intentional. This rule extends the base ESLint no-empty-function rule with TypeScript-specific support, including constructors with parameter properties, decorated functions, override methods, and various function types like async functions and generators.

Examples of incorrect code for this rule:

function foo() {}

const bar = () => {};

class MyClass {
  method() {}
  constructor() {}
}

Examples of correct code for this rule:

function foo() {
  // intentionally empty
}

const bar = () => {
  return;
};

class MyClass {
  constructor(private name: string) {}
}

Original Documentation