@@ -143,8 +143,8 @@ function contextCompare(
143143) {
144144 let aProp = getPropName ( a )
145145 let bProp = getPropName ( b )
146- const aPropWithoutNamespace = aProp . split ( ':' ) [ 0 ]
147- const bPropWithoutNamespace = bProp . split ( ':' ) [ 0 ]
146+ const aPropNamespace = aProp . split ( ':' ) [ 0 ]
147+ const bPropNamespace = bProp . split ( ':' ) [ 0 ]
148148
149149 const aSortToEnd = shouldSortToEnd ( a )
150150 const bSortToEnd = shouldSortToEnd ( b )
@@ -159,11 +159,7 @@ function contextCompare(
159159
160160 if ( aIndex === - 1 && bIndex > - 1 ) return 1
161161
162- if (
163- aIndex > - 1 &&
164- bIndex > - 1 &&
165- aPropWithoutNamespace !== bPropWithoutNamespace
166- )
162+ if ( aIndex > - 1 && bIndex > - 1 && aPropNamespace !== bPropNamespace )
167163 return aIndex > bIndex ? 1 : - 1
168164 }
169165
@@ -174,12 +170,8 @@ function contextCompare(
174170
175171 if ( aLastIndex === - 1 && bLastIndex > - 1 ) return - 1
176172
177- if (
178- aLastIndex > - 1 &&
179- bLastIndex > - 1 &&
180- aPropWithoutNamespace !== bPropWithoutNamespace
181- )
182- return aLastIndex > bLastIndex ? 1 : - 1
173+ if ( aLastIndex > - 1 && bLastIndex > - 1 && aPropNamespace !== bPropNamespace )
174+ return aLastIndex > bLastIndex ? - 1 : 1
183175 }
184176
185177 if ( options . callbacksLast ) {
@@ -566,6 +558,8 @@ const rule: RuleModule<MessageIds, RuleOptions> = {
566558
567559 let previousPropName = getPropName ( memo )
568560 let currentPropName = getPropName ( decl )
561+ const previousReservedNamespace = previousPropName . split ( ':' ) [ 0 ]
562+ const currentReservedNamespace = currentPropName . split ( ':' ) [ 0 ]
569563 const previousValue = ( memo as Tree . JSXAttribute ) . value
570564 const currentValue = decl . value
571565 const previousIsCallback = isCallbackPropName ( previousPropName )
@@ -609,6 +603,14 @@ const rule: RuleModule<MessageIds, RuleOptions> = {
609603
610604 return memo
611605 }
606+
607+ if (
608+ previousReservedIndex > - 1 &&
609+ currentReservedIndex > - 1 &&
610+ currentReservedIndex > previousReservedIndex &&
611+ previousReservedNamespace !== currentReservedNamespace
612+ )
613+ return decl
612614 }
613615
614616 if ( reservedLastList . length > 0 ) {
@@ -638,6 +640,14 @@ const rule: RuleModule<MessageIds, RuleOptions> = {
638640
639641 return memo
640642 }
643+
644+ if (
645+ previousReservedIndex > - 1 &&
646+ currentReservedIndex > - 1 &&
647+ currentReservedIndex > previousReservedIndex &&
648+ previousReservedNamespace !== currentReservedNamespace
649+ )
650+ return decl
641651 }
642652
643653 if ( callbacksLast ) {
0 commit comments