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

nextProps aren't handled by no-unused-props #1079

remcohaszing opened this issue Feb 20, 2017 · 2 comments

nextProps aren't handled by no-unused-props #1079

remcohaszing opened this issue Feb 20, 2017 · 2 comments


Copy link

I have the following (simplified) piece of code:

  componentWillReceiveProps(nextProps) {
    if (!nextProps.error) {
      console.log('oh noez');

This triggers the following ESLint error:

  89:27  error  'error' is missing in props validation  react/prop-types

However, if I do add error to propTypes, another error is triggered:

  33:10  error  'error' PropType is defined but prop is never used  react/no-unused-prop-types

I think the two rules should cooperate.

I'm using the following relevant packages:

  • eslint@3.15.0
  • eslint-config-airbnb@14.1.0
  • eslint-plugin-react@6.10.0
Copy link


@ljharb ljharb added the bug label Feb 21, 2017
Copy link

ljharb commented Feb 21, 2017

It's not really about "cooperation", but certainly both rules should be able to detect used props in nextProps identically.

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

No branches or pull requests

3 participants