LIST sort(map(file.inlinks, (theLink) => theLink.file.name))
This will make the sublinks (and only the sublinks) no longer links, but does that sort them correctly?
If so, you can probably get the linking back by wrapping the whole thing in another map:
LIST map(sort(map(file.inlinks, (theLink) => theLink.file.name)), (f) => link(f))
Note that this will have problems if you have two files with the same name in different places in your vault. link is expecting its argument to be a full path, not a filename. Obsidian and/or dataview seem to be smart about making links from just filenames work as long as your filenames are unique in your vault, but if you have two files with the same name there’s no way for it to know which one you want to link to without more information. Is this a situation you have to worry about for your vault?
I felt the same way trying to write it! If you aren’t familiar with map() and “arrow functions” those are concepts that are shared across several programming languages so there should be explanations that fit your way of thinking about things somewhere. For a one sentence version: map transforms a list by applying the specified transformation to every item in the list, keeping the items in the order they were already in. So we had a list of file.inlinks and we transformed them into a list of filenames. Then we sorted the list of file names. Then we transformed the sorted list of file names to be a list of links again.
Fun fact: any time your query uses the . notation for dataview fields such as file.inlinks, dataview is essentially doing a map operation behind the scenes, e.g. to turn a list of file objects into a list of each file’s inlinks! (This implies a question of when we can use the . notation as a shortcut and when we have to use map explicitly. I don’t know the answer: so far my approach has been entirely trial & error!)