Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

require-default-props does not detect properties in quotes #1201

Closed
zech opened this issue May 17, 2017 · 2 comments · Fixed by singapore/lint-condo#308
Closed

require-default-props does not detect properties in quotes #1201

zech opened this issue May 17, 2017 · 2 comments · Fixed by singapore/lint-condo#308

Comments

@zech
Copy link

zech commented May 17, 2017

Hi,

I've got an issue with code like this

DueEntryComponent.propTypes = {
    "isOverdue": PropTypes.bool
};

DueEntryComponent.defaultProps = {
    "isOverdue": false
};

triggers the message:

propType "isOverdue" is not required, but has no corresponding defaultProp declaration. (react/require-default-props)

changing the declaration to

DueEntryComponent.defaultProps = {
    isOverdue: false
};

omits the error.

I don't think quotes should have an effect on detecting defaultProps. Maybe I'm wrong ;-)

@ljharb
Copy link
Member

ljharb commented May 17, 2017

While unnecessarily quoted keys isn't my preferred style, I agree this should work. I think it should also work as a computed template literal with no interpolations.

@yannickcr
Copy link
Member

Fixed it for quoted properties. I will add template literal support in another patch.

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

Successfully merging a pull request may close this issue.

3 participants