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

False "react/prop-types [PROP_NAME] is missing in props validation" in a class based component having methods with destructured annotated params (Flow) #729

Closed
jtraub opened this issue Aug 1, 2016 · 0 comments

Comments

@jtraub
Copy link

jtraub commented Aug 1, 2016

Consider a following snippet

import React, { Component, PropTypes } from 'react';

type Target = { target: EventTarget }

class MyComponent extends Component {
  static propTypes = {
    children: PropTypes.any,
  }

  handler({ target }: Target) {
    if (target) {
      // do something
    }
  }

  render() {
    return (
      <div>
        {this.props.children}
      </div>
    );
  }

}

export default MyComponent;

Linting gives false error

./node_modules/.bin/eslint src/components/Test.js 

/mount/remote/test_env/src/components/Test.js
  19:21  error  'children' is missing in props validation  react/prop-types

✖ 1 problem (1 error, 0 warnings)

A quick look up shows that the problem is caused by this commit which fixes a similar problem.

P.S. This report is based on StackOverflow question.

@jtraub jtraub changed the title False "react/prop-types [PROP_NAME] is missing in props validation" in a class based component having methods with destructured annotate params (Flow) False "react/prop-types [PROP_NAME] is missing in props validation" in a class based component having methods with destructured annotated params (Flow) Aug 1, 2016
@yannickcr yannickcr added the bug label Aug 2, 2016
@ljharb ljharb added the flow label Jun 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants