Skip to content

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

Closed
@remcohaszing

Description

@remcohaszing

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions