preferEarlyReturnFunction body is wrapped in a single conditional without an else branch. This increases nesting depth and cognitive load. Invert the condition and return early: if (!condition) return; then place the main logic at the top level.small-rules/prefer-early-returnPrefer early returns over full-body conditional wrapping.
preferEarlyReturnFunction body is wrapped in a single conditional without an else branch. This increases nesting depth and cognitive load. Invert the condition and return early: if (!condition) return; then place the main logic at the top level.This rule accepts one options object after the severity.
function foo() { if (something) { doSomething(); doSomethingElse(); } }function foo() { if (!something) { return; } doSomething(); doSomethingElse(); }