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

propName should always return a value #50

Conversation

jessebeach
Copy link
Collaborator

Currently, the return value of propName is nullable. It should be able to guarantee a return value all the time.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.007%) to 98.788% when pulling 33e581a on jessebeach:propName--return-value-should-not-be-nullable into bc61ce9 on evcohen:master.

@jessebeach jessebeach force-pushed the propName--return-value-should-not-be-nullable branch from 33e581a to f520208 Compare July 6, 2017 22:58
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.007%) to 98.788% when pulling f520208 on jessebeach:propName--return-value-should-not-be-nullable into bc61ce9 on evcohen:master.

@jessebeach jessebeach force-pushed the propName--return-value-should-not-be-nullable branch from 7e29e3c to e89722b Compare July 6, 2017 23:25
@coveralls
Copy link

coveralls commented Jul 6, 2017

Coverage Status

Coverage decreased (-0.007%) to 98.788% when pulling e89722b on jessebeach:propName--return-value-should-not-be-nullable into bc61ce9 on evcohen:master.

@jessebeach
Copy link
Collaborator Author

Ya, the coverage fall is fine. I removed a test that doesn't test anything.

}

return prop.name.name;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could cause upstream failures if prop.name is undefined. Do we want to keep the switch statement and return an empty string, or do you think it's ok for an error to be thrown (i'm indifferent, its an edge case)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm in agreement with @ljharb here. A JSXAttribute without a name seems very unlikely.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good to me

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it can exist, then we should have a test case for it. Lacking one, we shouldn't expect it to exist :-)

@jessebeach
Copy link
Collaborator Author

@evcohen I don't have write access to this repo. Merge is all yours.

@beefancohen beefancohen merged commit 25fe686 into jsx-eslint:master Jul 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants