Skip to content

no-typos: destructured required propType throws an error #1489

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

Closed
alxmiron opened this issue Oct 19, 2017 · 2 comments
Closed

no-typos: destructured required propType throws an error #1489

alxmiron opened this issue Oct 19, 2017 · 2 comments

Comments

@alxmiron
Copy link

no-typos is a very nice rule, it helps a lot. But I have one case, where it throws useless error (and I have hundreds of them around my project)

  1. This is pattern is considered a warning:
const { bool } = PropTypes;
class MyComponent extends React.Component {
  static propTypes = {
    a: bool.isRequired
  }
}
  1. And this is not:
class MyComponent extends React.Component {
  static propTypes = {
    a: PropTypes.bool.isRequired
  }
}

Do you agree, that case 1 shouldn't throw any errors?

@ljharb
Copy link
Member

ljharb commented Oct 19, 2017

Duplicate of #1389

@ljharb ljharb marked this as a duplicate of #1389 Oct 19, 2017
@ljharb ljharb closed this as completed Oct 19, 2017
@alex-shamshurin
Copy link

Yes, I have the same issue. It works inside React.component extended class and doesn't work for stateless components

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