Skip to content

Add rule to require static propTypes = .. instad of Foo.propTypes = .. for class-based components #1923

@ThiefMaster

Description

@ThiefMaster

With such a rule the following would be invalid:

class Foo extends React.Component {}
Foo.propTypes = {...}
Foo.defaultProps = {...}

and this would be valid:

class Foo extends React.Component {
    static propTypes = {...};
    static defaultProps = {...};
}

function Bar() {
    return <>...</>;
}
Bar.propTypes = {...};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions