Skip to content

@eslint-react/no-implicit-key might be overly strict for ComponentProps #1472

Description

@ulrichstark

Starting from version 2.10.0 (#1466), lint rule @eslint-react/no-implicit-key might be overly strict for components accepting and spreading ComponentProps of some HTML element.

Components like the following are common, e.g. the shadcn PaginationItem:

function PaginationItem({ ...props }: React.ComponentProps<"li">) {
  return <li data-slot="pagination-item" {...props} />;
}

In our project after attempting to upgrade all dependencies, all new 129 problems can be traced back to very similar code. These aren't really false positives, but I also don't plan to fix them. The most logical step for us would unfortunately be to disable the lint rule in our project if behaviour stays the same. I'm not sure how the rule can be improved to consider this common pattern for declaring React components, but I wanted to create this issue anyway to document and to have a place to discuss a potential solution/workaround.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions