Skip to contentSlop Block

require-early-exit-on-new-line

Warning

Put a single-statement return or throw on the line after the if condition, with or without braces.

if (ready) return;Put this return or throw on the line after the if condition
if (ready) throw new Error("not ready");Put this return or throw on the line after the if condition
// ast-grep-ignore: require-early-exit-on-new-line-typescript

How to fix

Write the condition on one line and the early exit on the next, even when the if has no braces.

This rule has no fix. Let the formatter handle the surrounding indentation.