Skip to main content

no-expression-empty-lines

Disallow blank lines inside expression statements.

Targeted pattern scopeโ€‹

This rule inspects ExpressionStatement nodes and checks the expressionโ€™s raw source text for blank lines.

It only applies to expression statements and does not inspect declarations, blocks, or other statement kinds.

What this rule reportsโ€‹

This rule reports expression statements whose inner source text contains empty lines and auto-fixes by removing those empty lines.

Why this rule existsโ€‹

Blank lines inside a single expression usually come from accidental edits and make statement boundaries harder to read. Normalizing these expressions reduces formatting noise.

โŒ Incorrectโ€‹

someCall(1);

โœ… Correctโ€‹

someCall(1);

Behavior and migration notesโ€‹

This rule is autofixable.

The fixer removes blank lines inside the expression, trims trailing spaces on each line, and rewrites the statement with a terminating semicolon.

Optionsโ€‹

This rule has no options.

Additional examplesโ€‹

doWork(
value,

nextValue
);
// โŒ reported

doWork(value, nextValue);
// โœ… valid

ESLint flat config exampleโ€‹

import etcMisc from "eslint-plugin-etc-misc";

export default [
{
plugins: { "etc-misc": etcMisc },
rules: {
"etc-misc/no-expression-empty-lines": "error",
},
},
];

When not to use itโ€‹

Disable this rule if blank lines inside expressions are allowed for readability.

Package documentationโ€‹

Rule catalog ID: R024

Further readingโ€‹

Adoption resourcesโ€‹

  • Start at warning level in CI, then move to error after cleanup.
  • Use focused codemods/autofix batches per package or directory.