I use lexicographicSortSchema() to get a stable output when generating TS types from GraphQL schema and recently I discovered a problem when a field called chemicalName is misplaced and causing a diff.
The reason is that one of my machines has non-English, Czech locale and in Czech alphabet, the digraph Ch is handled as a single letter and sorted between H and I.
Example
const items = ['xx', 'aa', 'dd', 'cx', 'ch', 'cc'];
items.sort((a, b) => a.localeCompare(b, 'en'));
// ["aa", "cc", "ch", "cx", "dd", "xx"]
items.sort((a, b) => a.localeCompare(b, 'cs'));
// ["aa", "cc", "cx", "dd", "ch", "xx"]
Would be great if lexicographicSortSchema() could accept locales and possibly also options parameters for localeCompare to be able to force a particular (English) locale for the schema sorting independently on the machine's locale.
I use
lexicographicSortSchema()to get a stable output when generating TS types from GraphQL schema and recently I discovered a problem when a field calledchemicalNameis misplaced and causing a diff.The reason is that one of my machines has non-English, Czech locale and in Czech alphabet, the digraph Ch is handled as a single letter and sorted between H and I.
Example
Would be great if
lexicographicSortSchema()could acceptlocalesand possibly alsooptionsparameters forlocaleCompareto be able to force a particular (English) locale for the schema sorting independently on the machine's locale.