jsx-eslint/eslint-plugin-react

[jsx-key]: report on `yield`

Open

#352 建立於 2015年12月7日

在 GitHub 查看
 (2 留言) (1 反應) (0 負責人)JavaScript (8,630 star) (2,797 fork)batch import
enhancementhelp wantedrule

描述

Seems like yield <Component x={y}/> should be reported by jsx-key if there is no key prop.

This is valid:

for (let [idx, datum] of data.entries()) {
  yield (<MyComponent datum={datum} key={idx} />)
}

This is reported:

for (let [idx, datum] of data.entries()) {
  yield (<MyComponent datum={datum} />) // msg: need `key` prop
}

I can knock this out, if it makes sense.

(cc #332 as it will likely conflict with this if completed concurrently.)

貢獻者指南