math/prefer-number-min-safe-integer โ
enforce the use of Number.MIN_SAFE_INTEGER instead of other ways
- โ๏ธ This rule is included in
"plugin:math/recommended"
. - ๐ง The
--fix
option on the command line can automatically fix some of the problems reported by this rule. - ๐ก Some problems reported by this rule are manually fixable by editor suggestions.
๐ Rule Details โ
This rule aims to enforce the use of Number.MIN_SAFE_INTEGER
instead of other ways to represent the minimum safe integer value.
Number.MIN_SAFE_INTEGER
provides several advantages over hardcoded values:
- Clarity of intent: Immediately obvious that you're using the minimum safe integer
- Precision: Guaranteed to be the exact minimum safe integer value (-(2โตยณ - 1))
- Maintainability: Avoids potential typos in hexadecimal or decimal literals
- Self-documenting: Makes the code intention clear without comments
๐ง Options โ
Nothing.
๐ Further reading โ
๐ Version โ
This rule was introduced in eslint-plugin-math v0.3.0