Fix remaining localeCompare without locale set

This commit is contained in:
Koen Vlaswinkel
2023-06-06 10:55:15 +02:00
parent a7a24fc0e9
commit a678f8b3bc
2 changed files with 5 additions and 3 deletions

View File

@@ -195,7 +195,8 @@ export function compareInputOutput(a: string, b: string): number {
// If either one is unknown, it is sorted last
if (aIndex === -1 && bIndex === -1) {
return a.localeCompare(b);
// Use en-US because these are well-known strings that are not localized
return a.localeCompare(b, "en-US");
}
if (aIndex === -1) {
return 1;

View File

@@ -94,8 +94,9 @@ export function compareRepository(
}
}
// Fall back on name compare
return left.fullName.localeCompare(right.fullName, undefined, {
// Fall back on name compare. Use en-US because the repository name does not contain
// special characters due to restrictions in GitHub owner/repository names.
return left.fullName.localeCompare(right.fullName, "en-US", {
sensitivity: "base",
});
};