Query module ImplicitOperandConversion

name
Implicit operand conversion
description
Relying on implicit conversion of operands is error-prone and makes code hard to read.
kind
problem
problem.severity
warning
id
js/implicit-operand-conversion
tags
reliability readability external/cwe/cwe-704
precision
very-high

Imports

javascript

Provides classes for working with JavaScript programs, as well as JSON, YAML and HTML.

Classes

ConstructorConversion

The right-hand operand of instanceof should be a function or class.

ImplicitConversion

An expression that appears in a syntactic position where its value may be implicitly converted.

ImplicitConversionWithWhitelist

An implicit conversion with a whitelist of types for which the implicit conversion is harmless.

IndexExprConversion

Property names in index expressions are converted to strings, so they should be Booleans, strings or numbers.

NullOrUndefinedConversion

An expression whose value should not be null or undefined.

NumericConversion

Operands of arithmetic and bitwise operations are converted to numbers, so they should be Booleans, numbers or Dates.

ObjectConversion

Expressions that are interpreted as objects shouldn’t be primitive values.

PlusConversion

Operands of + or += are converted to strings or numbers, and hence should not be null or undefined.

PropertyNameConversion

Property names in in expressions are converted to strings, so they should be strings or numbers.

RelationalOperandConversion

Operands of relational operators are converted to strings or numbers, and hence should be strings, numbers or Dates.

TemplateElementConversion

Template literal elements are converted to strings, and hence should not be null or undefined.