目录

@typescript-eslint/lines-between-class-members

Require or disallow an empty line between class members.

Rule Configuration

// code-linter.json5
{
  "rules": {
    "@typescript-eslint/lines-between-class-members": "error"
  }
}

Options

This rule has two options. The first option can be a string or an object, and the second option must be an object. For details, see eslint/lines-between-class-members.

The second option supports configuring the exceptAfterOverload property, which indicates whether to skip checking for blank lines after overloaded class members. exceptAfterOverload is a Boolean value: when set to true, it means skipping the check; when set to false, it means not skipping the check. The default value is true.

Example:

"@typescript-eslint/lines-between-class-members": [
  "error",
  "always",
  {
    "exceptAfterOverload": true
  },
]

Example of Correct Code

// By default, an empty line is required between class members.
export class Foo {
  public baz() {
    console.info('baz');
  }

  public qux() {
    console.info('qux');
  }
}

Example of Incorrect Code

// By default, an empty line is required between class members.
export class Foo {
  public baz() {
    console.info('baz');
  }
  public qux() {
    console.info('qux');
  }
}

Rule Set

plugin:@typescript-eslint/all

For details about how to configure Code Linter check rules, see Code Linter.