vim-jsx-utils icon indicating copy to clipboard operation
vim-jsx-utils copied to clipboard

JSXEachAttributeInLine doesn't put boolean attributes on their own line

Open DanielFGray opened this issue 7 years ago • 2 comments

<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

DanielFGray avatar Apr 16 '17 20:04 DanielFGray

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.

samuelsimoes avatar May 05 '17 20:05 samuelsimoes

I actually prefer the current implementation. You can also try SplitJoin.vim which maps gS to do the same.

dkarter avatar Jan 05 '18 22:01 dkarter