@@ -50,7 +50,7 @@ ruleTester.run('jsx-key', rule, {
5050 { code : 'foo(() => <></>);' , parser : parsers . BABEL_ESLINT } ,
5151 { code : '<></>;' , parser : parsers . BABEL_ESLINT }
5252 ] ,
53- invalid : [ {
53+ invalid : [ ] . concat ( {
5454 code : '[<App />];' ,
5555 errors : [ { message : 'Missing "key" prop for element in array' } ]
5656 } , {
@@ -69,6 +69,14 @@ ruleTester.run('jsx-key', rule, {
6969 code : '[1, 2 ,3].map(x => { return <App /> });' ,
7070 errors : [ { message : 'Missing "key" prop for element in iterator' } ]
7171 } , {
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+ } ) , {
7280 code : '[1, 2, 3].map(x => <>{x}</>);' ,
7381 parser : parsers . BABEL_ESLINT ,
7482 options : [ { checkFragmentShorthand : true } ] ,
@@ -80,5 +88,5 @@ ruleTester.run('jsx-key', rule, {
8088 options : [ { checkFragmentShorthand : true } ] ,
8189 settings,
8290 errors : [ { message : 'Missing "key" prop for element in array. Shorthand fragment syntax does not support providing keys. Use Act.Frag instead' } ]
83- } ]
91+ } )
8492} ) ;
0 commit comments