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

7.14.0: no-unused-prop-types throws exception on intermediate destructuring props #2323

Closed
johnhunter opened this issue Jun 24, 2019 · 3 comments

Comments

@johnhunter
Copy link

Version 7.14.0

Using intermediate destructuring of props in a class render method throws an exception. This seems to have been introduced in the v7.14.0 release

The following fails with VariableDeclarator ASTNodes are not handled by markPropTypesAsUsed:

  render() {
    const { chartData, chartTitle, loading, className } = this.props;
    const { legendData, title, tooltip } = chartTitle;
  ...

Whereas the following passes:

  render() {
    const {
      chartData,
      chartTitle: { legendData, title, tooltip },
      loading,
      className
    } = this.props;
  ...

Relevant propTypes are:

chartData: PropTypes.array.isRequired,
chartTitle: PropTypes.object.isRequired,
loading: PropTypes.bool.isRequired,
className: PropTypes.string

I didn't expect the intermediate destructuring to fail, but if it is invalid then it should fail cleanly rather than throw.

@golopot
Copy link
Contributor

golopot commented Jun 24, 2019

Duplicate of #2319. Fix is merged in master but waiting for release.

@yannickcr
Copy link
Member

Just released v7.14.1 with the fix 🙂

@johnhunter
Copy link
Author

Great! thanks.

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

No branches or pull requests

3 participants