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.