after-multiline

When a statement that spans lines gets a blank line after it, and what outranks that.

a statement that spans several lines is followed by a blank line

A statement is multi-line when it starts and ends on different lines: a call with its arguments on their own lines, an object literal, an if whose block body spans lines, a loop, a try. The rule applies to every gap after such a statement, at every level below module top level.

Two rules outrank it. short-body removes the blank when the list holds two or three compact statements, and guard-chain removes it between two braceless two line guards. It outranks every join rule, so a multi-line declaration never joins the if, return, loop or try that reads it. The example shows that: raw is read by the guard, and the blank line still goes in.

When the next statement begins on the line where the multi-line statement ends, nothing is inserted between them. A switch clause whose body starts on the line after its label is multi-line too, so the blank line before the next label is reported under this rule rather than switch-clauses.

Example

Before
function parseConfig(text: string) {
  const raw = JSON.parse(
    text,
  );
  if (!isRecord(raw)) throw new Error("config must be an object");
  return raw;
}
After
function parseConfig(text: string) {
  const raw = JSON.parse(
    text,
  );

  if (!isRecord(raw)) throw new Error("config must be an object");
  return raw;
}

On this page