Skip to content

Rule for no optional props without default values? #673

Closed
@EdwardDrapkin

Description

@EdwardDrapkin

Hello friends,

I was looking for a way to enforce a code quality guideline with eslint and seem to be unable. Basically, we have a bunch of React components that define optional properties. I'd like eslint to guarantee that all non required properties are required to have default values (e.g. if propTypes has a value of foo: React.propTypes.string, defaultProps has to have a key of foo set too). Is this currently possible?

TIA!

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