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

Messing up jsx formatting multi-line attribute #914

Closed
buinauskas opened this issue Apr 8, 2016 · 5 comments
Closed

Messing up jsx formatting multi-line attribute #914

buinauskas opened this issue Apr 8, 2016 · 5 comments
Milestone

Comments

@buinauskas
Copy link

I've got latest version installed. My files are opened as Babel JS files and I have e4x set to true in my configuration file. This is what I have currently:

return (
  <a href="#"
    onClick={e => {
      e.preventDefault()
      onClick()
    }}>
    {children}
  </a>
);

However, after formatting it becomes this:

return ( < a href = "#"
  onClick = {
    e => {
      e.preventDefault()
      onClick()
    }
  } > { children } < /a>
);

What do I need to change to have my files formatted properly or at least not messed up?

@bitwiseman
Copy link
Member

Have you set e4x=true?

@buinauskas
Copy link
Author

@bitwiseman Yes, I did.

@Firef0x
Copy link

Firef0x commented May 1, 2016

Me too with e4x=true! It's really weird. 😂

@bitwiseman bitwiseman added this to the v1.6.3 milestone May 1, 2016
@bitwiseman
Copy link
Member

Thanks! I've added it to my list for the next version.

@bitwiseman
Copy link
Member

Here's what I have found out about this issue:

// successful - no change
return(
    <a href="#" onClick={e => {      e.preventDefault()      onClick()}}>
    {children}
  </a>
);


// successful - no change
return <b><a href="#"
    onClick={e => {
      e.preventDefault()
      onClick()
    }}>
    {children}
  </a></b>;

// failure - adds spaces 
return <a href="#"
    onClick={e => {
      e.preventDefault()
      onClick()
    }}>
    {children}
</b>;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants