Skip to content

forbid-prop-types w/ es6 classes #514

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
foxtree opened this issue Mar 25, 2016 · 3 comments
Closed

forbid-prop-types w/ es6 classes #514

foxtree opened this issue Mar 25, 2016 · 3 comments

Comments

@foxtree
Copy link

foxtree commented Mar 25, 2016

forbid-prop-types does not work when propTypes are declared using an es6 static member:

  static get propTypes() {
    return {
      store: PropTypes.object.isRequired,
      history: PropTypes.object.isRequired,
      DevTools: PropTypes.func.isRequired
    };
  }

...however, display-name still works correctly, when using a similar es6 notation:

  static get displayName() {return 'Root';}
@foxtree
Copy link
Author

foxtree commented Mar 25, 2016

I suppose both rules work with the following syntax (sans getter):

  static displayName = 'Root';

  static propTypes = {
    store: PropTypes.object.isRequired,
    history: PropTypes.object.isRequired,
    DevTools: PropTypes.func.isRequired
  };

@alexzherdev
Copy link
Contributor

@ljharb
Copy link
Member

ljharb commented Jun 28, 2018

Looks like #1533 fixed this.

@ljharb ljharb closed this as completed Jun 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants