@@ -50,7 +50,7 @@ ruleTester.run('jsx-key', rule, {
50
50
{ code : 'foo(() => <></>);' , parser : parsers . BABEL_ESLINT } ,
51
51
{ code : '<></>;' , parser : parsers . BABEL_ESLINT }
52
52
] ,
53
- invalid : [ {
53
+ invalid : [ ] . concat ( {
54
54
code : '[<App />];' ,
55
55
errors : [ { message : 'Missing "key" prop for element in array' } ]
56
56
} , {
@@ -69,6 +69,14 @@ ruleTester.run('jsx-key', rule, {
69
69
code : '[1, 2 ,3].map(x => { return <App /> });' ,
70
70
errors : [ { message : 'Missing "key" prop for element in iterator' } ]
71
71
} , {
72
+ code : '[1, 2, 3]?.map(x => <BabelEslintApp />)' ,
73
+ parser : parsers . BABEL_ESLINT ,
74
+ errors : [ { message : 'Missing "key" prop for element in iterator' } ]
75
+ } , parsers . TS ( {
76
+ code : '[1, 2, 3]?.map(x => <TypescriptEslintApp />)' ,
77
+ parser : parsers [ '@TYPESCRIPT_ESLINT' ] ,
78
+ errors : [ { message : 'Missing "key" prop for element in iterator' } ]
79
+ } ) , {
72
80
code : '[1, 2, 3].map(x => <>{x}</>);' ,
73
81
parser : parsers . BABEL_ESLINT ,
74
82
options : [ { checkFragmentShorthand : true } ] ,
@@ -80,5 +88,5 @@ ruleTester.run('jsx-key', rule, {
80
88
options : [ { checkFragmentShorthand : true } ] ,
81
89
settings,
82
90
errors : [ { message : 'Missing "key" prop for element in array. Shorthand fragment syntax does not support providing keys. Use Act.Frag instead' } ]
83
- } ]
91
+ } )
84
92
} ) ;
0 commit comments