# prefer-math-abs 📝 Prefer `Math.abs()` over manual absolute value expressions and symmetric range checks. 💼 This rule is enabled in the following [configs](https://github.com/sindresorhus/eslint-plugin-unicorn#recommended-config): ✅ `recommended`, ☑️ `unopinionated`. 🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). This rule enforces the use of `Math.abs()` instead of hand-written absolute value expressions and symmetric range checks. ## Examples ```js // ❌ const absolute = value < 0 ? -value : value; // ❌ const absolute = value <= 0 ? 0 - value : value; // ❌ const absolute = value > 0 ? value : -value; // ✅ const absolute = Math.abs(value); ``` ```js // ❌ if (number > MAXIMUM || number < -MAXIMUM) { } // ✅ if (Math.abs(number) > MAXIMUM) { } ```