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

Handle member expressions in jsx-props-no-multi-spaces #1890

Merged

Conversation

alexzherdev
Copy link
Contributor

Resolves #1881

case 'JSXIdentifier':
return propNode.name;
case 'JSXMemberExpression':
return `${propNode.object.name}.${propNode.property.name}`;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will not handle Foo.Bar.Baz, do we need that?

Copy link
Member

Choose a reason for hiding this comment

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

I think it should handle dots, yes - and if bracket notation is supported, that too (but i don’t think it is)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean Foo['Bar']? Yeah, looks like it's not supported according to Babel REPL.

Copy link
Member

Choose a reason for hiding this comment

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

To clarify; it should handle any number of nested member expressions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I hope recursion is good enough for practical uses 😄

@@ -114,5 +116,11 @@ ruleTester.run('jsx-props-no-multi-spaces', rule, {
errors: [
{message: 'Expected only one space between "Foo.Bar" and "baz"'}
]
}, {
code: '<Foobar.Foo.Bar.Baz.Qux.Quux.Quuz.Corge.Grault.Garply.Waldo.Fred.Plugh xyzzy="thud" />',
Copy link
Member

Choose a reason for hiding this comment

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

This test has been eaten by a grue.

@ljharb ljharb added the bug label Jul 20, 2018
@ljharb ljharb force-pushed the 1881-no-multi-spaces-undefined branch from fda7ea3 to 2aa0955 Compare July 21, 2018 19:43
@ljharb ljharb merged commit 1a28f3f into jsx-eslint:master Jul 21, 2018
@alexzherdev alexzherdev deleted the 1881-no-multi-spaces-undefined branch July 21, 2018 19:51
This was referenced Sep 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

2 participants