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

[Fix] `no-unused-prop-types`: handle optional chaining #2679

Merged
merged 1 commit into from Jun 29, 2020

Conversation

@hank121314
Copy link
Contributor

hank121314 commented Jun 29, 2020

Handle optional chaining in usedPropTypes.

Before:

const Hello = props => {
  const firstname = props?.name;
  return <div />;
};

Hello.propTypes = {
  name: PropTypes.string.isRequired, <<< 'name' PropType is defined but prop is never used eslint(react/no-unused-prop-types)
};

After this pr the error should be resolved.

@ljharb
ljharb approved these changes Jun 29, 2020
Copy link
Collaborator

ljharb left a comment

Thanks!

@ljharb ljharb merged commit 85e40aa into yannickcr:master Jun 29, 2020
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@ljharb
Copy link
Collaborator

ljharb commented Jun 29, 2020

I'll have the fix released later today.

@ljharb ljharb changed the title [Fix]`no-unused-prop-types`:handle optional chaining [Fix] `no-unused-prop-types`: handle optional chaining Jun 29, 2020
@ljharb
Copy link
Collaborator

ljharb commented Jun 29, 2020

v7.20.2 is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.