Inspectopedia Help

Control flow issues

'for' loop may be replaced by 'while' loop  

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

'if' statement with identical branches  

Reports an if statement with identical then and else branches.

'if' statement with too many branches  

Reports an if statement with too many branches.

Conditional expression with identical branches  

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

Constant conditional expression  

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

Duplicate condition in 'if' statement  

Reports duplicate conditions in different branches of an if statement.

Loop statement that doesn't loop  

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

Object is 'null' or 'undefined'  

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  

Reports a pointless or pointlessly complicated boolean expression or statement.

Redundant 'if' statement  

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

Redundant conditional expression  

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

Tail recursion  

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

Unnecessary 'continue' statement  

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

Unnecessary 'return' statement  

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  

Reports an unused label.

Unnecessary label on 'break' statement  

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

Unnecessary label on 'continue' statement  

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

Unreachable code  

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

Unsound type guard check  

Reports a typeof or instanceof unsound type guard check.

Last modified: 18 June 2024