Skip to content

New rule: lifecycle param name #2289

Open
@golopot

Description

@golopot

The rule enforces that lifecycle parameter names exactly matches the well known names. For example, a prevProps should not be named as props, because people might confuse it with this.props.

This are considered warnings:

class Foo extends Component {
  componentDidUpdate(props) {}
//                   ~~~~~ Error: should be `prevProps`.
  shouldComponentUpdate(prevProps, nextState) {}
//                      ~~~~~~~~~ Error: should be `nextProps`.
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions