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

[evcohen/eslint-plugin-jsx-a11y#399] Accommodate ExperimentalSpreadProperty in prop values #75

Merged
merged 1 commit into from
Mar 17, 2019

Conversation

jessebeach
Copy link
Collaborator

A pattern like this:

<Link to={{ pathname: manageRoute, state: {...data}}} />

Will cause ObjectExpression to throw an error. This diff properly treats ExperimentalSpreadProperty as a SpreadProperty.

@coveralls
Copy link

coveralls commented Mar 17, 2019

Coverage Status

Coverage remained the same at 98.844% when pulling cb82b33 on jessebeach:undefined-value-expression into a1e5007 on evcohen:master.

@@ -9,7 +9,8 @@ import getValue from './index';
export default function extractValueFromObjectExpression(value) {
return value.properties.reduce((obj, property) => {
const object = Object.assign({}, obj);
if (property.type === 'SpreadProperty') {
// Support types: SpreadProperty and ExperimentalSpreadProperty
if (/SpreadProperty/.test(property.type)) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (/SpreadProperty/.test(property.type)) {
if (/^(?:Experimental)?SpreadProperty$/.test(property.type)) {

this seems a bit more robust

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ljharb I like the way you regex.

@jessebeach jessebeach merged commit 525da04 into jsx-eslint:master Mar 17, 2019
@jessebeach jessebeach deleted the undefined-value-expression branch March 17, 2019 20:16
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.

3 participants