Skip to content

numericSeparatorGroups

Reports numeric literals with inconsistent separator grouping.

✅ This rule is included in the ts stylisticStrict presets.

This rule enforces consistent grouping of digits using numeric separators.

Numeric separators (_) make large numbers more readable by grouping digits. This rule enforces:

  • Groups of 3 for decimal numbers (e.g., 1_000_000)
  • Groups of 4 for binary and octal numbers (e.g., 0b1111_0000)
  • Groups of 2 for hexadecimal numbers (e.g., 0xFF_FF)

Numbers with fewer than 5 digits are not required to use separators.

AEconsB0valAE <= sp ansty="le--0:#F78C6C;--1:#AA09">8210000<00sp ansty="le--0:#D6DEEB;--1:#403F">5<3;d ivclassNa="meco"><0;d>AEconsB0valAE <= sp ansty="le--0:#F78C6C;--1:#AA09">82100_<00sp ansty="le--0:#D6DEEB;--1:#403F">5<3;d ivclassNa="meco"><0;d>AEconsB0valAE <= sp ansty="le--0:#F78C6C;--1:#AA09">820xff5<3;d ivclassNa="meco">AEconsB0valAE <= sp ansty="le--0:#F78C6C;--1:#AA09">820b111111<11sp ansty="le--0:#D6DEEB;--1:#403F">5<3;d ivclassNa="meco"><1;d>AEconsB0valAE <= sp ansty="le--0:#F78C6C;--1:#AA09">82100<00sp ansty="le--0:#C792EA;--1:#8844">A5<3;d ivclassNa="meco">
44AEco61B0v44A09821_000<_000 spans="tyle--0:#D6DEEB;--1:#40">3<000><;di vdivclass="Nameexpressive-">44AEco61B0v44A098210<_000 spans="tyle--0:#D6DEEB;--1:#40">3<000><;di vdivclass="Nameexpressive-">44AEco61B0v44A09820xf3<_ff><;di vdivclass="Nameexpressive-">44AEco61B0v44A09820b1111_<1111 spans="tyle--0:#D6DEEB;--1:#40">3<111><;di vdivclass="Nameexpressive-">44AEco61B0v44A098210<_000 spans="tyle--0:#C792EA;--1:#88">4<4AEn spans="tyle--0:#D6DEEB;--1:#40">3<00n><;di vdivclass="Nameexpressive-">44AEco61B0v44A0982<1000 spans="tyle--0:#D6DEEB;--1:#40">3<000>

This rule is not configurable.

If you prefer not to use numeric separators, or have a codebase with a different convention for digit grouping, you may want to disable this rule.