Skip to content

Error: 'is missing in props validation' after update of ESLint to v5.4.0 #1957

Closed

Description

By now we validated our props like this:

class HelloEs6 extends React.Component {
  render() {
    return <div>Hello {this.props.name}</div>;
  }
}
HelloEs6.propTypes = {
  name: PropTypes.string.isRequired,
};

But after an update of ESLint from v4.19.1 to v5.4.0 we always get the 'is missing in props validation' error.

If we put the validation inside of the class it works perfectly like this:

class HelloEs6 extends React.Component {
  render() {
    return <div>Hello {this.props.name}</div>;
  }

  propTypes = {
    name: PropTypes.string.isRequired,
  };
}

Why is that the case? We couldn't find anything in the changelog according to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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