Skip to content

Suggestion: no-redundant-key #3880

Open
@SimonSchick

Description

I noticed that after refactorings we sometimes forgot to remove the key on the root fragment of a new component, this seems to be entirely redundant and just add overhead.

example:

const Component: FC = () => {
          // v key is redundant here
   return <p key={1}>test</test>;
}

This would be effectively the counter-rule to `https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-key

I think a good heuristic would be to match any fragment that is not contained within a callback eg. Array.map.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions