vim-jsx-utils
vim-jsx-utils copied to clipboard
JSXEachAttributeInLine doesn't put boolean attributes on their own line
<Route exact path="/" component={Home} />
for example becomes
<Route exact
path="/"
component={Home} />
instead of
<Route
exact
path="/"
component={Home} />
also I really think that the closing bracket should be at the same column as the opening tag, as in eslint rule for jsx-closing-bracket-location
Hi,
So, what this extension does is get each attribute and swap each catch with the catch value with a \n
on the catch's beginning with the RegExp \w+=[{|'|"]
(actual implementation).
The problem is, right now I don't know any way to get the boolean values without getting things that I shouldn't. Look the current implementation: http://rubular.com/r/wl5G5a9W7y
If you know some RegExp that can catch just the attribute's beginning on the scenario above, I'll gladly fix this.
About the position of the closing bracket, please create another issue to keep this focused. I have an idea to create a config for this.
I actually prefer the current implementation. You can also try SplitJoin.vim which maps gS
to do the same.