You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using numeric separators in numbers as keys, the natural order obviously breaks. For example, while 100 will be sorted after 2, 1_000 or 1_000_000 or "10,000" will not.
Regular number strings with arbitrary separators like "10,000" or "1.000.000" or "100 000"
This probably harder to implement but maybe could be done with a configurable option to specify which characters between numbers in keys should be ignored in a string. Or maybe just a simple on an off switch for common separators.
I think natural sorting for the rules sort-array-includes, sort-maps and sort-objects should respect number literal separators by default, and for strings there should be some kind of option.
Especially sort-array-includes and sort-maps would profit from this since they have no partition-by-comment or partition-by-new-line options, so the only "workarounds" right now are either to not use separators at all (which are enforced by unicorn/numeric-separators-style in my case at least) or to disable the rule.
What rule do you want to change?
sort-array-includes
,sort-maps
,sort-objects
Describe the problem
When using numeric separators in numbers as keys, the natural order obviously breaks. For example, while
100
will be sorted after2
,1_000
or1_000_000
or"10,000"
will not.Code example
This issue is actually kind of two in one:
1_000
or1_000_000
"10,000"
or"1.000.000"
or"100 000"
Additional comments
I think natural sorting for the rules
sort-array-includes
,sort-maps
andsort-objects
should respect number literal separators by default, and for strings there should be some kind of option.Especially
sort-array-includes
andsort-maps
would profit from this since they have nopartition-by-comment
orpartition-by-new-line
options, so the only "workarounds" right now are either to not use separators at all (which are enforced byunicorn/numeric-separators-style
in my case at least) or to disable the rule.Validations
The text was updated successfully, but these errors were encountered: