Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Eschon opened this issue Sep 9, 2016 · 3 comments · Fixed by singapore/lint-condo#240
Closed

Comments

@Eschon
Copy link

Eschon commented Sep 9, 2016

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 />;
  }
});
@mqklin
Copy link

mqklin commented Jan 8, 2018

@yannickcr seems like it isn't fixed:
react/prop-types doesn't warn if I get props from nextProps
image

In this case there should be an Error about x as well.

@Eschon did you resolve the issue?

@ljharb
Copy link
Member

ljharb commented Jan 8, 2018

Since this is from a year ago, could you file a new issue for your use case?

@mqklin
Copy link

mqklin commented Jan 8, 2018

Yes, today I'll do it

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

Successfully merging a pull request may close this issue.

3 participants