Skip to content

Commit

Permalink
fix(lint/useJsxKeyInIterable): fix a false positive when key is in pa…
Browse files Browse the repository at this point in the history
…renthesized return statement (#3205)
  • Loading branch information
unvalley committed Jun 14, 2024
1 parent cc075b5 commit b70f405
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b

- Add [nursery/noShorthandPropertyOverrides](https://biomejs.dev/linter/rules/no-shorthand-property-overrides). [#2958](https://github.com/biomejs/biome/issues/2958) Contributed by @neokidev

#### Bug fixes

- Fix [[#3084](https://github.com/biomejs/biome/issues/3084)] false positive by correctly recognize parenthesized return statement. Contributed by @unvalley

### CLI

#### Enhancement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ fn handle_function_body(
.as_ref()
.and_then(|ret| {
let returned_value = ret.argument()?;
let returned_value = unwrap_parenthesis(returned_value)?;
Some(ReactComponentExpression::can_cast(
returned_value.syntax().kind(),
))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,9 @@ React.Children.map(c => React.cloneElement(c, {key: c}));
[].map((item) => {
const node = <button type="button">{item.label}</button>;
return <Fragment key={item.label}>{node}</Fragment>;
})
});

[].map((el) => {
const content = <p>Paragraph</p>
return (<div key={el}>{content}</div>);
});
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ React.Children.map(c => React.cloneElement(c, {key: c}));
[].map((item) => {
const node = <button type="button">{item.label}</button>;
return <Fragment key={item.label}>{node}</Fragment>;
})
});

[].map((el) => {
const content = <p>Paragraph</p>
return (<div key={el}>{content}</div>);
});

```

0 comments on commit b70f405

Please sign in to comment.