Provides classes and predicates for the ‘js/useless-expression’ query.
Import path
import Expressions.ExprHasNoEffect
Imports
| DOMProperties | Provides predicates for working with the DOM type hierarchy.
|
| javascript | Provides classes for working with JavaScript programs, as well as JSON, YAML and HTML.
|
Predicates
| hasNoEffect | Holds if the expression e should be reported as having no effect.
|
| inVoidContext | Holds if e appears in a syntactic context where its value is discarded.
|
| isCompoundExpression | Holds if e is a compound expression that may contain sub-expressions with side effects. We should not flag these directly as useless since we want to flag only the innermost expressions that actually have no effect.
|
| isDeclaration | Holds if e is of the form x; or e.p; and has a JSDoc comment containing a tag. In that case, it is probably meant as a declaration and shouldn’t be flagged by this query.
|
| isGetterProperty | Holds if there exists a getter for a property called name anywhere in the program.
|
| isIndirectEval | Holds if c is an indirect eval call of the form (dummy, eval)(...), where dummy is some expression whose value is discarded, and which simply exists to prevent the call from being interpreted as a direct eval.
|
| isReceiverSuppressingCall | Holds if c is a call of the form (dummy, e[p])(...), where dummy is some expression whose value is discarded, and which simply exists to prevent the call from being interpreted as a method call.
|
| noSideEffects | Holds if evaluating e has no side effects (except potentially allocating and initializing a new object).
|