Skip to content

[Bug]: no-unknown-property false-positive without data- prefix #3712

Closed
@silverwind

Description

@silverwind

Is there an existing issue for this?

  • I have searched the existing issues and my issue is unique
  • My issue appears in the command-line and not only in the text editor

Description Overview

<Item dataKey="key"/>
react/no-unknown-property: [2, requireDataLowercase: true}]

Raises false positive:

React does not recognize data-* props with uppercase characters on a DOM element. Found 'dataKey', use 'datakey' instead

Expected Behavior

No error because dataKey doesn't start with data-. The rule docs specifically mentions that it's only checking data-* attributes, e.g. with the -.

eslint-plugin-react version

v7.34.0

eslint version

v8.57.0

node version

v21.7.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions