Skip to content

Commit

Permalink
[Test] jsx-key: add a test case for optional chaining
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanLee-LX authored and ljharb committed Mar 29, 2020
1 parent bea3b30 commit 77c505c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/lib/rules/jsx-key.js
Expand Up @@ -68,6 +68,14 @@ ruleTester.run('jsx-key', rule, {
}, {
code: '[1, 2 ,3].map(x => { return <App /> });',
errors: [{message: 'Missing "key" prop for element in iterator'}]
}, {
code: '[1, 2, 3]?.map(x => <App />)',
parser: parsers.BABEL_ESLINT,
errors: [{message: 'Missing "key" prop for element in iterator'}]
}, {
code: '[1, 2, 3]?.map(x => <App />)',
parser: parsers['@TYPESCRIPT_ESLINT'],
errors: [{message: 'Missing "key" prop for element in iterator'}]
}, {
code: '[1, 2, 3].map(x => <>{x}</>);',
parser: parsers.BABEL_ESLINT,
Expand Down

0 comments on commit 77c505c

Please sign in to comment.