@@ -17,7 +17,7 @@ import {
17
17
partitionByNewLineJsonSchema ,
18
18
newlinesBetweenJsonSchema ,
19
19
customGroupsJsonSchema ,
20
- commonJsonSchemas ,
20
+ buildCommonJsonSchemas ,
21
21
groupsJsonSchema ,
22
22
regexJsonSchema ,
23
23
} from '../utils/common-json-schemas'
@@ -68,7 +68,7 @@ type MESSAGE_ID =
68
68
| 'unexpectedObjectTypesOrder'
69
69
70
70
let defaultOptions : Required < Options [ 0 ] > = {
71
- fallbackSort : { type : 'unsorted' } ,
71
+ fallbackSort : { type : 'unsorted' , sortBy : 'name' } ,
72
72
partitionByComment : false ,
73
73
partitionByNewLine : false ,
74
74
newlinesBetween : 'ignore' ,
@@ -89,11 +89,18 @@ let defaultOptions: Required<Options[0]> = {
89
89
export let jsonSchema : JSONSchema4 = {
90
90
items : {
91
91
properties : {
92
- ...commonJsonSchemas ,
92
+ ...buildCommonJsonSchemas ( {
93
+ additionalFallbackSortProperties : {
94
+ sortBy : sortByJsonSchema ,
95
+ } ,
96
+ } ) ,
93
97
customGroups : {
94
98
oneOf : [
95
99
customGroupsJsonSchema ,
96
- buildCustomGroupsArrayJsonSchema ( { singleCustomGroupJsonSchema } ) ,
100
+ buildCustomGroupsArrayJsonSchema ( {
101
+ additionalFallbackSortProperties : { sortBy : sortByJsonSchema } ,
102
+ singleCustomGroupJsonSchema,
103
+ } ) ,
97
104
] ,
98
105
} ,
99
106
useConfigurationIf : buildUseConfigurationIfJsonSchema ( {
@@ -363,13 +370,17 @@ export let sortObjectTypeElements = <MessageIds extends string>({
363
370
filteredGroupKindNodes . flatMap ( groupedNodes =>
364
371
sortNodesByGroups ( {
365
372
getOptionsByGroupNumber : groupNumber => {
366
- let { options : overriddenOptions , nodeValueGetter } =
367
- getCustomGroupsCompareOptions ( options , groupNumber )
373
+ let {
374
+ fallbackSortNodeValueGetter,
375
+ options : overriddenOptions ,
376
+ nodeValueGetter,
377
+ } = getCustomGroupsCompareOptions ( options , groupNumber )
368
378
return {
369
379
options : {
370
380
...options ,
371
381
...overriddenOptions ,
372
382
} ,
383
+ fallbackSortNodeValueGetter,
373
384
nodeValueGetter,
374
385
}
375
386
} ,
0 commit comments