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:

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

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy