numericErasingOperations
Reports operations that always result in zero, such as multiplication by zero.
✅ This rule is included in the ts logicalStrict presets.
This rule reports operations that always result in zero, regardless of the other operand.
These “erasing” operations typically indicate a logic error where the developer may have intended a different operation.
The entire expression can be replaced with 0 directly.
Examples
Section titled “Examples”44AEco44AEco44AEco44AEcoOptions
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”If you are intentionally using these operations for their side effects or as a stylistic choice to indicate the result should be zero, you may want to disable this rule.
However, in most cases, directly using 0 is clearer.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- Oxlint:
oxc/erasing-op
