-
-
Notifications
You must be signed in to change notification settings - Fork 476
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
💅 useJsxKeyInIterable
: Not working when component starts on the next line
#2011
Comments
Can confirm. v1.6.0. |
I have been learning Rust recently and want to get my feet wet. Can I give this a try? @ematipico |
@Sec-ant All yours :) |
@Sec-ant This seems to be still happening. Is it meant to work when a component spans multiple lines? All the examples are one-liners. |
Would you mind providing the problematic code snippet? |
@Sec-ant Managed to narrow it down. It breaks if you have a return inside the map: const testArr = [
{ id: 1, name: 'test' },
{ id: 2, name: 'test2' },
{ id: 3, name: 'test3' },
{ id: 4, name: 'test4' },
]
export function TestFoo() {
return (
<div>
<h1>Hello from Foo</h1>
<ul>
{testArr.map(item => {
const { id, name } = item
// Breaks useJsxKeyInIterable
return (
<li key={id}>
<p>{name}</p>
</li>
)
})}
</ul>
</div>
)
} |
@Sec-ant you rock! |
Environment information
Rule name
useJsxKeyInIterable
Playground link
https://biomejs.dev/playground/?lintRules=all&code=YwBvAG4AcwB0ACAAZgByAHUAaQB0AHMAIAA9ACAAWwAiAEEAcABwAGwAZQAiACwAIAAiAEIAYQBuAGEAbgBhACIALAAgACIATwByAGEAbgBnAGUAIgBdADsACgAKAGUAeABwAG8AcgB0ACAAZgB1AG4AYwB0AGkAbwBuACAARgBvAG8AZAAoACkAIAB7AAoAIAAgAHIAZQB0AHUAcgBuACAAKAAKACAAIAAgACAAPABkAGkAdgA%2BAAoAIAAgACAAIAAgACAAPABoADEAPgBGAG8AbwBkADwALwBoADEAPgAKACAAIAAgACAAIAAgADwAdQBsAD4ACgAgACAAIAAgACAAIAAgACAAewBmAHIAdQBpAHQAcwAuAG0AYQBwACgAKABmAHIAdQBpAHQAKQAgAD0APgAgACgACgAgACAAIAAgACAAIAAgACAAIAAgADwAbABpACAAawBlAHkAPQB7AGYAcgB1AGkAdAB9AD4AewBmAHIAdQBpAHQAfQA8AC8AbABpAD4ACgAgACAAIAAgACAAIAAgACAAKQApAH0ACgAgACAAIAAgACAAIAA8AC8AdQBsAD4ACgAgACAAIAAgADwALwBkAGkAdgA%2BAAoAIAAgACkAOwAKAH0ACgA%3D
Expected result
On the attached playground, the following reports
Cannot determine whether this child has the required key prop.
. However, if I place the JSX on the same line as the map, it doesn't report.This reports:
This doesn't:
Code of Conduct
The text was updated successfully, but these errors were encountered: