JavaScript allowsDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/sindresorhus/eslint-plugin-unicorn/llms.txt
Use this file to discover all available pages before exploring further.
_ as a numeric separator to improve readability of long numbers, but separators can be placed arbitrarily, which defeats the purpose. This rule enforces consistent grouping so that 1_000_000 is always written that way and never as 1_0000_00 or similar.
| Recommended | ✅ recommended · ☑️ unopinionated |
| Fixable | 🔧 |
| Suggestions | — |
Configuration options
Each number type (binary, octal, hexadecimal, number) accepts its own options object with the following properties. You can also set onlyIfContainsSeparator at the top level to apply it to all types.
onlyIfContainsSeparator
Type: booleanDefault:
false
When true, the rule only checks numbers that already contain a _ separator. You can set this at the top level or override it per number type.
minimumDigits
Type: integerMinimum:
0
The minimum number of digits before separator grouping is enforced. Numbers with fewer digits are always valid.
groupLength
Type: integerMinimum:
1
The number of digits in each group. The leading group may be shorter than groupLength; all subsequent groups must be exactly groupLength digits.