Skip to content

Commit

Permalink
test: add broken test case for jsx-key rule
Browse files Browse the repository at this point in the history
  • Loading branch information
yialo committed Sep 5, 2023
1 parent 422ff33 commit 228b644
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/lib/rules/jsx-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,5 +387,27 @@ ruleTester.run('jsx-key', rule, {
{ messageId: 'missingIterKey' },
],
},
{
code: `
const TestCase = () => {
const list = [1, 2, 3, 4, 5];
return (
<div>
{list.map(item => {
if (item < 2) return <div>{item}</div>;
else if (item < 5) return <div />;
else return <div />;
})}
</div>
);
};
`,
errors: [
{ messageId: 'missingIterKey' },
{ messageId: 'missingIterKey' },
{ messageId: 'missingIterKey' },
],
},
]),
});

0 comments on commit 228b644

Please sign in to comment.