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

prop-types validation doesn't run for every stateless component #1046

Closed
prithsharma opened this issue Jan 25, 2017 · 0 comments
Closed

prop-types validation doesn't run for every stateless component #1046

prithsharma opened this issue Jan 25, 2017 · 0 comments

Comments

@prithsharma
Copy link

Test case -
If a function is of the form

() => {
  return <some_jsx />;
}

the prop-types rule is checked as expected.

But if the function is of the form

() => {
  const returnValue = <some_jsx />;
  return returnValue;
}

it seems the the prop-types rule is not checked and no lint errors are thrown if there are no propType validations.

Possible reason - Referring to this comment, I think the plugin identifies a function as a React component if it returns some JSX. In the case above, the plugin somehow fails to identify it as returning some JSX.

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

No branches or pull requests

2 participants