Skip to content

VBC-502: redundant-boolean-logic

warning

Category: clean-code
Analysis: Semantic
Tags: clean-code semantic

What it reports

Redundant boolean return detected. This if/else block can be replaced by a single 'return' with a boolean expression.

Flagged

ts
function check(a) {
  if (a) { return true; } else { return false; }
}

Not flagged

ts
function check(a) {
  return Boolean(a);
}

Released under the MIT License.