@@ -88,6 +88,10 @@ const reservedFirstWithNoSortAlphabeticallyArgs = [{
88
88
noSortAlphabetically : true ,
89
89
reservedFirst : true
90
90
} ] ;
91
+ const reservedFirstWithShorthandLast = [ {
92
+ reservedFirst : true ,
93
+ shorthandLast : true
94
+ } ] ;
91
95
const reservedFirstAsEmptyArrayArgs = [ {
92
96
reservedFirst : [ ]
93
97
} ] ;
@@ -149,6 +153,10 @@ ruleTester.run('jsx-sort-props', rule, {
149
153
{
150
154
code : '<div ref="r" dangerouslySetInnerHTML={{__html: "EPR"}} key={0} children={<App />} b a c />' ,
151
155
options : reservedFirstWithNoSortAlphabeticallyArgs
156
+ } ,
157
+ {
158
+ code : '<App key="key" c="c" b />' ,
159
+ options : reservedFirstWithShorthandLast
152
160
}
153
161
] ,
154
162
invalid : [
@@ -230,6 +238,16 @@ ruleTester.run('jsx-sort-props', rule, {
230
238
` ,
231
239
errors : 3
232
240
} ,
241
+ {
242
+ code : '<App key="key" b c="c" />' ,
243
+ errors : [ expectedShorthandLastError ] ,
244
+ options : reservedFirstWithShorthandLast
245
+ } ,
246
+ {
247
+ code : '<App ref="ref" key="key" isShorthand veryLastAttribute="yes" />' ,
248
+ errors : [ expectedError , expectedShorthandLastError ] ,
249
+ options : reservedFirstWithShorthandLast
250
+ } ,
233
251
{
234
252
code : '<App a z onFoo onBar />;' ,
235
253
errors : [ expectedError ] ,
@@ -293,7 +311,7 @@ ruleTester.run('jsx-sort-props', rule, {
293
311
code : '<App dangerouslySetInnerHTML={{__html: "EPR"}} e key={2} b />' ,
294
312
options : reservedFirstAsBooleanArgs ,
295
313
output : '<App key={2} b dangerouslySetInnerHTML={{__html: "EPR"}} e />' ,
296
- errors : [ expectedReservedFirstError ]
314
+ errors : [ expectedReservedFirstError , expectedError ]
297
315
} ,
298
316
{
299
317
code : '<App key={3} children={<App />} />' ,
0 commit comments