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

Teach prop-types about destructing in function signatures #430

Merged

Conversation

lencioni
Copy link
Collaborator

@lencioni lencioni commented Feb 6, 2016

The following should cause an error for missing propType validations,
but it doesn't.

  const Test = ({ name }) => {
    return (
      <div>{name}</div>
    );
  };

If you replace the destructuring with using the props object, it works
as expected. This commit fixes this problem.

Fixes #354.

The following should cause an error for missing propType validations,
but it doesn't.

  const Test = ({ name }) => {
    return (
      <div>{name}</div>
    );
  };

If you replace the destructuring with using the props object, it works
as expected. This commit fixes this problem.

Fixes jsx-eslint#354.
@lencioni lencioni force-pushed the stateless-destructured-prop-types branch from 686bcb3 to 59f26d7 Compare February 6, 2016 17:10
@ljharb
Copy link
Member

ljharb commented Feb 6, 2016

(ノ◕ヮ◕)ノ*:・゚✧ awesome!

yannickcr added a commit that referenced this pull request Feb 7, 2016
Add support to prop-types for destructing in function signatures (fixes #354)
@yannickcr yannickcr merged commit b2661aa into jsx-eslint:master Feb 7, 2016
@yannickcr
Copy link
Member

Merged, thanks!

@ljharb
Copy link
Member

ljharb commented Feb 7, 2016

@yannickcr yay! version bump soon? :-D

@lencioni
Copy link
Collaborator Author

lencioni commented Feb 7, 2016

Thanks! If you are thinking about releasing a new version, it would be really swell if #429 could sneak in it as well.

@lencioni lencioni deleted the stateless-destructured-prop-types branch February 7, 2016 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

prop-types doesn't complain about destructured props in stateless functions
3 participants