💅 useJsxKeyInIterable
: Key prop in React TSX / JSX is not checked in switch statements
#4715
Open
1 task done
Labels
A-Linter
Area: linter
L-JavaScript
Language: JavaScript and super languages
S-Bug-confirmed
Status: report has been confirmed as a valid bug
Environment information
Rule name
lint/correctness/useJsxKeyInIterable
Playground link
https://biomejs.dev/playground/?code=CgBjAG8AbgBzAHQAIABNAHkAQwBvAG0AcABvAG4AZQBuAHQAOgAgAEYAQwAgAD0AIAAoACkAIAA9AD4AIAB7AAoAIAAgAGMAbwBuAHMAdAAgAGUAbgB0AHIAaQBlAHMAIAA9ACAAWwAKACAAIAAgACAAewAgAHYAYQBsAHUAZQA6ACAAJwBhACcALAAgAHQAeQBwAGUAOgAgACcAcwB0AHIAaQBuAGcAJwAgAH0ALAAKACAAIAAgACAAewAgAHYAYQBsAHUAZQA6ACAAOQAsACAAdAB5AHAAZQA6ACAAJwBuAHUAbQBiAGUAcgAnACAAfQAsAAoAIAAgACAAIAB7ACAAdgBhAGwAdQBlADoAIAAnAGMAJwAsACAAdAB5AHAAZQA6ACAAJwBzAHQAcgBpAG4AZwAnACAAfQAsAAoAIAAgAF0AIABhAHMAIABjAG8AbgBzAHQACgAgACAAcgBlAHQAdQByAG4AIAAoAAoAIAAgACAAIAA8AD4ACgAgACAAIAAgACAAIAB7AC8AKgAgAAUnIABjAG8AcgByAGUAYwB0ACAAKgAvAH0ACgAgACAAIAAgACAAIAB7AGUAbgB0AHIAaQBlAHMALgBtAGEAcAAoACgAeAApACAAPQA%2BACAAKAAKACAAIAAgACAAIAAgACAAIAA8AGQAaQB2ACAAawBlAHkAPQB7AHgALgB2AGEAbAB1AGUAfQA%2BAHsAeAAuAHYAYQBsAHUAZQB9ADwALwBkAGkAdgA%2BAAoAIAAgACAAIAAgACAAKQApAH0ACgAgACAAIAAgACAAIAB7AC8AKgAgAAUnIABlAG0AaQB0AHMAOgAgAE0AaQBzAHMAaQBuAGcAIABrAGUAeQAgAHAAcgBvAHAAZQByAHQAeQAgAGYAbwByACA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AIAAgADwALwA%2BAAoAIAAgACkACgB9AAoA
Expected result
The last
.map
of entries should emit an error about a missing key prop inside the switch statement. This is isolated by switch statements.Additionally, map lambdas with branching return do not emit the error on early return branches.
Code of Conduct
The text was updated successfully, but these errors were encountered: