Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Latest commit

 

History

History
30 lines (22 loc) · 386 Bytes

prefer-single-boolean-return.md

File metadata and controls

30 lines (22 loc) · 386 Bytes

prefer-single-boolean-return

🔧 fixable

Return of boolean literal statements wrapped into if-then-else flow should be simplified.

Noncompliant Code Example

if (expression) {
  return true;
} else {
  return false;
}

or

if (expression) {
  return true;
}
return false;

Compliant Solution

return expression;