@@ -143,8 +143,8 @@ function contextCompare(
143
143
) {
144
144
let aProp = getPropName ( a )
145
145
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 ]
148
148
149
149
const aSortToEnd = shouldSortToEnd ( a )
150
150
const bSortToEnd = shouldSortToEnd ( b )
@@ -159,11 +159,7 @@ function contextCompare(
159
159
160
160
if ( aIndex === - 1 && bIndex > - 1 ) return 1
161
161
162
- if (
163
- aIndex > - 1 &&
164
- bIndex > - 1 &&
165
- aPropWithoutNamespace !== bPropWithoutNamespace
166
- )
162
+ if ( aIndex > - 1 && bIndex > - 1 && aPropNamespace !== bPropNamespace )
167
163
return aIndex > bIndex ? 1 : - 1
168
164
}
169
165
@@ -174,12 +170,8 @@ function contextCompare(
174
170
175
171
if ( aLastIndex === - 1 && bLastIndex > - 1 ) return - 1
176
172
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
183
175
}
184
176
185
177
if ( options . callbacksLast ) {
@@ -566,6 +558,8 @@ const rule: RuleModule<MessageIds, RuleOptions> = {
566
558
567
559
let previousPropName = getPropName ( memo )
568
560
let currentPropName = getPropName ( decl )
561
+ const previousReservedNamespace = previousPropName . split ( ':' ) [ 0 ]
562
+ const currentReservedNamespace = currentPropName . split ( ':' ) [ 0 ]
569
563
const previousValue = ( memo as Tree . JSXAttribute ) . value
570
564
const currentValue = decl . value
571
565
const previousIsCallback = isCallbackPropName ( previousPropName )
@@ -609,6 +603,14 @@ const rule: RuleModule<MessageIds, RuleOptions> = {
609
603
610
604
return memo
611
605
}
606
+
607
+ if (
608
+ previousReservedIndex > - 1 &&
609
+ currentReservedIndex > - 1 &&
610
+ currentReservedIndex > previousReservedIndex &&
611
+ previousReservedNamespace !== currentReservedNamespace
612
+ )
613
+ return decl
612
614
}
613
615
614
616
if ( reservedLastList . length > 0 ) {
@@ -638,6 +640,14 @@ const rule: RuleModule<MessageIds, RuleOptions> = {
638
640
639
641
return memo
640
642
}
643
+
644
+ if (
645
+ previousReservedIndex > - 1 &&
646
+ currentReservedIndex > - 1 &&
647
+ currentReservedIndex > previousReservedIndex &&
648
+ previousReservedNamespace !== currentReservedNamespace
649
+ )
650
+ return decl
641
651
}
642
652
643
653
if ( callbacksLast ) {
0 commit comments