eslint-plugin-react icon indicating copy to clipboard operation
eslint-plugin-react copied to clipboard

[Fix]: detect missing keys in return statement with ternary operator

Open hyeonbinHur opened this issue 6 months ago • 1 comments

Fix #3925

hyeonbinHur avatar May 26 '25 11:05 hyeonbinHur

Invalid Test Cases (4)

Case Scenario AST Patterns Covered
1: Basic Pattern return + ternary in map with ArrowFunction • ArrowFunction + BlockStatement + ReturnStatement
• ConditionalExpression with JSX elements
• Missing key detection in ternary branches
2: Function Expression return + ternary in map with regular function • FunctionExpression + BlockStatement + ReturnStatement
• ConditionalExpression handling across function types
• Same logic applies to function() syntax
3: Array.from Method return + ternary in Array.from iteration • Array.from + checkFunctionsBlockStatement call
• ConditionalExpression in different iteration contexts
• Multiple iteration method support
4: Fragment Context return + ternary within Fragment (Original Issue) • Fragment + map + return + ternary pattern
• Real-world user scenario reproduction
• Issue #3925 exact replication

Valid Test Cases (1)

Case Scenario Corresponding Invalid Case
1: Proper Keys return + ternary with correct key props Invalid 1

hyeonbinHur avatar May 26 '25 11:05 hyeonbinHur