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
Handle member expressions in jsx-props-no-multi-spaces #1890
Conversation
case 'JSXIdentifier': | ||
return propNode.name; | ||
case 'JSXMemberExpression': | ||
return `${propNode.object.name}.${propNode.property.name}`; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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" />', |
There was a problem hiding this comment.
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.
fda7ea3
to
2aa0955
Compare
Resolves #1881