Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Bug]: react/jsx-key rule is not applied when using return statement and ternary operator in iterator #3925

Open
@Dorianspeed

Description

@Dorianspeed

Is there an existing issue for this?

  • I have searched the existing issues and my issue is unique

Description Overview

Brief description

As described in the title,react/jsx-key is not applied when using return statement and ternary operator in iterator.
It's working when not using return statement as shown in my below picture.

Picture showing the current issue

Image

Code to reproduce error

Here is a small code snippet to reproduce the current error:

import{Fragment}from'react';constITEMS=['bar','foo'];exportdefaultfunctionBugIssue(){return(<Fragment>{ITEMS.map((item)=>{returnitem==='bar' ?<div>{item}</div> :<span>{item}</span>;})}</Fragment>);}

Expected Behavior

An error should be displayed when using return statement and ternary operator.

=>Missing "key" prop for element in iterator

eslint-plugin-react version

v7.37.3

eslint version

9.27.0

node version

v22.15.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp