Skip to content

Require JSX event handler names to follow conventions (react/jsx-handler-names) #1371

@feross

Description

@feross

https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md

Ensures that any component or prop methods used to handle events are correctly prefixed.

Rule Details

The following patterns are considered warnings:

<MyComponent handleChange={this.handleChange} />
<MyComponent onChange={this.componentChanged} />

The following patterns are not considered warnings:

<MyComponent onChange={this.handleChange} />
<MyComponent onChange={this.props.onFoo} />

Here's an example of the diff that I applied to bitmidi.com in order to comply with this rule: feross/bitmidi.com@67ed076

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions