avoid-inconsistent-digit-separators
Warns when the digit separators create inconsistent groups of digits.
Inconsistent groups are usually a sign of a typo and can significantly reduce readability.
Example
❌ Bad:
void fn() {
// LINT: This number has inconsistent number of digits in separated groups.
// Try making the groups consistent.
final value = 1_00_000;
// LINT: This number has inconsistent number of digits in separated groups.
// Try making the groups consistent.
final value = 11_00_0;
// LINT: This number has inconsistent number of digits in separated groups.
// Try making the groups consistent.
final another = 1_00_00_000;
// LINT: This number has inconsistent number of digits in separated groups.
// Try making the groups consistent.
final another = 1_00.000_00_1;
}
✅ Good:
void fn() {
final value = 10_00_00;
final dbl = 1_10_00;
}