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
Merged

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

merged 1 commit into from Jun 29, 2020

Conversation

hank121314
Copy link
Contributor

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.

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ljharb ljharb merged commit 85e40aa into jsx-eslint:master Jun 29, 2020
@ljharb
Copy link
Member

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
Member

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
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants