Since at least 2018, the order is alphabetical, with periods and numbers coming before letters.
That is, as mentioned in Andrew D.Bond’s answer:
$
.
(dot)- Numbers
- Leading space (although the space doesn’t appear after saving, the sort order is still updated)
(although bis, in Sept. 2020, IvanaGyro adds in the comments leading spaces will not affect the order any more) _
(underscore)- Letters (case insensitive)
Around 2013-2014 a different order was used. See Andrew D. Bond’s answer for more.