Skip to content

Check that ES6 static propTypes/defaultProps are not functions? #1174

Closed
@victor-homyakov

Description

It is possible to erroneously define propTypes and defaultProps in ES6 class as function. In that case React will silently ignore them. See first component in example at https://jsbin.com/jidupehebu/edit?js,console

Is it possible to add a rule to check that propTypes and defaultProps are properly defined (either static property initializers from ES7 proposal or static property getters, but not functions)?

Activity

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

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions