Skip to content

prop-types doesn't check nextProps of componentWillReceiveProps #814

Closed
singapore/lint-condo
#240
@Eschon

Description

@Eschon

This is kind of related to #801 but as far as I can tell the PR to fix (#792) it doesn't fix my issue. I modified the reproduction case from #801 there to show my issue:

import React, {PropTypes} from "react";

export default React.createClass({

  propTypes: {
    bar: PropTypes.func,
  },

  componentWillReceiveProps (nextProps) {
    if (nextProps.foo) { // this line should trigger the 'prop-types' rule but doesn't
      return;
    }
  },

  render () {
    this.props.bar;
    return <div />;
  }
});

Metadata

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