mihai-vlc / sublime-jsfmt

jsfmt plugin for Sublime Text

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fails when trying to format this

octohedron opened this issue · comments

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?

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 ?

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

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.