mihai-vlc / sublime-jsfmt

jsfmt plugin for Sublime Text
MIT License
477 stars 21 forks source link

Fails when trying to format this #46

Closed octohedron closed 8 years ago

octohedron commented 8 years ago

Try it, doesn't throw an error but instead of formatting, it puts everything in one line.

const TodoListItem = class extends React.Component {
  renderLeft() {
        const props = this.props;
        return (
            <span className='todo-row-description smaller3 gray'>
                Created by <strong>{props.creatorName}</strong> for <strong>{props.Name}</strong><br />
                Created on  <strong>{moment(props.createdAt).format(DATE_FORMAT)}</strong><br />
                Last updated on <strong>{moment(props.updatedAt).format(DATE_FORMAT)}</strong><br />
                Status: <strong className={className({blue:props.status==='finished'})}>{props.status}</strong>
            </span>
        )
  }
}

Preset is default-whitespace-before, might be jsfmt fault?

mihai-vlc commented 8 years ago

I am getting some formatting issues but definitely not everything in one line.

Did you follow the configuration guide from here: https://github.com/royriojas/esformatter-jsx/wiki/Usage-with-jsfmt ?

octohedron commented 8 years ago

Yep, I guess I'm getting the same formatting issues as you.

mihai-vlc commented 8 years ago

this is what I get after I format it:

const TodoListItem = class extends React.Component {
  renderLeft() {
    const props = this.props;
    return (
      <span className='todo-row-description smaller3 gray'>
                Created by <strong>{props.creatorName}</strong> for <strong>{props.Name}</strong><br />
                Created on  <strong>{moment(props.createdAt).format(DATE_FORMAT)}</strong><br />
                Last updated on <strong>{moment(props.updatedAt).format(DATE_FORMAT)}</strong><br />
                Status: <strong className={className({
        blue: props.status === 'finished'
      })}>{props.status}</strong>
            </span>
    )
  }
}

There are some small issues in the markup. You can try to open an issue on the https://github.com/royriojas/esformatter-jsx repo.