Skip to content

require-default-props error message cannot handle quoted props #1161

Closed
@sheepsteak

Description

@sheepsteak

The following is with [email protected].

If a propType is quoted for some reason like this:

MyComponent.propTypes = {
  'data-id': PropTypes.string,
};

Then the require-default-props rule gives the following warning:

propType "undefined" is not required, but has no corresponding defaultProp declaration.

Howwever, giving the propType a default value like this does satisfy the rule:

MyComponent.defaultProps = {
  'data-id': 'test',
};

It seems like this is an issue with the formatting of the error message.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions