Skip to content

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

Closed
@sheepsteak

Description

The following is with eslint-plugin-react@6.10.3.

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.

Activity

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

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