Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs] jsx-key: improve example #3202

Merged
merged 1 commit into from Feb 11, 2022
Merged

Conversation

chnakamura
Copy link
Contributor

Using an index for a key is a violation of the no-array-index-key lint rule, so it feel weird to me that we're showing it as an example for "correct" code, even though it isn't strictly a violation of the js-key rule.

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@@ -22,7 +22,7 @@ Examples of **correct** code for this rule:
```jsx
[<Hello key="first" />, <Hello key="second" />, <Hello key="third" />];

data.map((x, i) => <Hello key={i}>{x}</Hello>);
data.map(x => <Hello key={x.id}>{x}</Hello>);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
data.map(x => <Hello key={x.id}>{x}</Hello>);
data.map((x) => <Hello key={x.id}>{x}</Hello>);

@codecov-commenter
Copy link

codecov-commenter commented Feb 11, 2022

Codecov Report

Merging #3202 (53e0722) into master (7dfcbfb) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3202   +/-   ##
=======================================
  Coverage   97.63%   97.63%           
=======================================
  Files         121      121           
  Lines        8416     8416           
  Branches     3025     3025           
=======================================
  Hits         8217     8217           
  Misses        199      199           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7dfcbfb...53e0722. Read the comment docs.

@ljharb ljharb changed the title Update jsx-key.md [Docs] jsx-key: improve example Feb 11, 2022
@ljharb ljharb merged commit 53e0722 into jsx-eslint:master Feb 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

3 participants