felipeochoa / rjsx-mode

A JSX major mode for Emacs
https://github.com/felipeochoa/rjsx-mode
MIT License
641 stars 32 forks source link

Different (incorrect) indent behaviour from js2-jsx-mode #67

Closed tarka closed 6 years ago

tarka commented 6 years ago

I've noted the comment about indentation bugs, however I'm seeing a behaviour in rjsx-mode that this not present in js2.

In js2-jsx-mode the following code is formatted correctly:

function Example(props) {
  return (
    <ul>
      {
        [1,2,3].map(lang => {
          return(
            <li key={lang}>
              {lang}
            </li>
          )
        })
      }
    </ul>
  )
}

However, in rjsx-mode it is formatted as:

function Example(props) {
  return (
    <ul>
      {
        [1,2,3].map(lang => {
          return(
            <li key={lang}>
              {lang}
            </li>
          )
        })
    }
    </ul>
  )
}

(note the brace before the </ul>).

Versions:

felipeochoa commented 6 years ago

Thanks for reporting (and taking the time to check against js2-jsx)! This was in fact a bug in rjsx. Fix will be up on Melpa soon