-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add jsx-key rule * fix: clippy * fix: update schemas * message Co-authored-by: Bartek Iwańczuk <[email protected]> * message Co-authored-by: Bartek Iwańczuk <[email protected]> * message Co-authored-by: Bartek Iwańczuk <[email protected]> * fixup * chore: simplify indentation --------- Co-authored-by: Bartek Iwańczuk <[email protected]>
- Loading branch information
1 parent
1e76fc0
commit 3aca2e7
Showing
5 changed files
with
515 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Ensure the `key` attribute is present when passing iterables into JSX. It allows | ||
frameworks to optimize checking the order of elements. | ||
|
||
### Invalid: | ||
|
||
```tsx | ||
const foo = [<div>foo</div>]; | ||
const foo = [<>foo</>]; | ||
[1, 2, 3].map(() => <div />); | ||
Array.from([1, 2, 3], () => <div />); | ||
``` | ||
|
||
### Valid: | ||
|
||
```tsx | ||
const foo = [<div key="a">foo</div>]; | ||
const foo = [<Fragment key="b">foo</Fragment>]; | ||
[1, 2, 3].map((x) => <div key={x} />); | ||
Array.from([1, 2, 3], (x) => <div key={x} />); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.