Content-Length: 271244 | pFad | https://redirect.github.com/jsx-eslint/eslint-plugin-react/issues/1079

E9 nextProps aren't handled by no-unused-props · Issue #1079 · jsx-eslint/eslint-plugin-react · GitHub
Skip to content

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

@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









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://redirect.github.com/jsx-eslint/eslint-plugin-react/issues/1079

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy