Skip to content

Commit 10cdb5e

Browse files
committed
fixup! feat(jsx-key): check for array related method calls with jsx elements/fragments
1 parent 148f70c commit 10cdb5e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docs/rules/jsx-key.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ Array.from([1, 2, 3], (x) => <Hello>{x}</Hello>);
2727
<Hello {...{ key: id, id, caption }} />
2828
```
2929

30+
```jsx
31+
arr = [];
32+
arr.push(<Hello />);
33+
```
34+
3035
In the last example the key is being spread, which is currently possible, but discouraged in favor of the statically provided key.
3136

3237
Examples of **correct** code for this rule:
@@ -47,6 +52,11 @@ Array.from([1, 2, 3], (x) => <Hello key={x}>{x}</Hello>);
4752
<Hello key={id} {...{ id, caption }} />
4853
```
4954

55+
```jsx
56+
arr = [];
57+
arr.push(<Hello key="hello" />);
58+
```
59+
5060
## Rule Options
5161

5262
```js

0 commit comments

Comments
 (0)