Skip to content

Commit 73c4c61

Browse files
akahoshi1421ljharb
authored andcommitted
[Docs] no-array-index-key: add template literal examples
1 parent 25249f3 commit 73c4c61

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
1313
* [`no-unknown-property`]: allow `onLoad` on `body` ([#3923][] @DerekStapleton)
1414
* [`no-unknown-property`]: allow `closedby` on `dialog` ([#3980][] @ljharb)
1515

16+
### Changed
17+
* [Docs] [`no-array-index-key`]: add template literal examples ([#3978][] @akahoshi1421)
18+
19+
[#3978]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3978
1620
[#3980]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3980
1721
[#3930]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3930
1822
[#3923]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3923

docs/rules/no-array-index-key.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,18 @@ things.map((thing, index) => (
1919
<Hello key={index} />
2020
));
2121

22+
things.map((thing, index) => (
23+
<Hello key={`hello-${index}`} />
24+
));
25+
2226
things.map((thing, index) => (
2327
React.cloneElement(thing, { key: index })
2428
));
2529

30+
things.map((thing, index) => (
31+
React.cloneElement(thing, { key: `hello-${index}` })
32+
));
33+
2634
things.forEach((thing, index) => {
2735
otherThings.push(<Hello key={index} />);
2836
});
@@ -75,10 +83,18 @@ things.map((thing) => (
7583
<Hello key={thing.id} />
7684
));
7785

86+
things.map((thing) => (
87+
<Hello key={`hello-${thing.id}`} />
88+
));
89+
7890
things.map((thing) => (
7991
React.cloneElement(thing, { key: thing.id })
8092
));
8193

94+
things.map((thing) => (
95+
React.cloneElement(thing, { key: `hello-${thing.id}` })
96+
));
97+
8298
things.forEach((thing) => {
8399
otherThings.push(<Hello key={thing.id} />);
84100
});

0 commit comments

Comments
 (0)