jsx-eslint/eslint-plugin-react

no-array-index-key not triggered when spreading props

Open

#1,625 opened on Dec 24, 2017

 (2 comments) (0 reactions) (0 assignees)JavaScript (2,734 forks)batch import
enhancementhelp wanted

Repository metrics

Stars
 (9,294 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

There's no warning or error when doing something like this:

people.map(({ name, email }, key) => {
  const props = {
    key,
    name,
    email,
  };

  return <Person {...props} />;
});

I realize this is a bit of an edge case, but maybe we can find a way to catch these uses as well.

Contributor guide