Inspectopedia Help

Control flow issues

'for' loop may be replaced by 'while' loop   New in this release

Reports a for loop that contains neither initialization nor an update component.

'if' statement with identical branches   New in this release

Reports an if statement with identical then and else branches.

'if' statement with too many branches   New in this release

Reports an if statement with too many branches.

Conditional expression with identical branches   New in this release

Reports a ternary conditional expression with identical then and else branches.

Constant conditional expression   New in this release

Reports a conditional expression in the format true? result1: result2 or false? result1: result2.

Duplicate condition in 'if' statement   New in this release

Reports duplicate conditions in different branches of an if statement.

Loop statement that doesn't loop   New in this release

Reports a for, while, or do statement whose bodies are guaranteed to execute at most once.

Object is 'null' or 'undefined'   New in this release

Reports an error caused by invoking a method, accessing a property, or calling a function on an object that is undefined or null.

Pointless statement or boolean expression   New in this release

Reports a pointless or pointlessly complicated boolean expression or statement.

Redundant 'if' statement   New in this release

Reports an if statement that can be simplified to a single assignment or a return statement.

Redundant conditional expression   New in this release

Reports a conditional expression of the form condition ? true : false condition ? false : true These expressions may be safely converted to condition !condition.

Tail recursion   New in this release

Reports a tail recursion, that is, when a function calls itself as its last action before returning.

Unnecessary 'continue' statement   New in this release

Reports an unnecessary continue statement at the end of a loop.

Unnecessary 'return' statement   New in this release

Reports an unnecessary return statement, that is, a return statement that returns no value and occurs just before the function would have "fallen through" the bottom.

Unnecessary label   New in this release

Reports an unused label.

Unnecessary label on 'break' statement   New in this release

Reports a labeled break statement whose labels may be removed without changing the flow of control.

Unnecessary label on 'continue' statement   New in this release

Reports a labeled continue statement whose labels may be removed without changing the flow of control.

Unreachable code   New in this release

Reports code that can never be executed, which almost certainly indicates an error.

Unsound type guard check   New in this release

Reports a typeof or instanceof unsound type guard check.

Last modified: 11 September 2024