aaronjensen / eslintd-fix

Emacs minor-mode to automatically fix javascript with eslint_d.
64 stars 8 forks source link

In some cases the current buffer is replaced with an eslint error #3

Closed RobinClowers closed 7 years ago

RobinClowers commented 7 years ago

It's a very strange edge case, I'm not really sure what causes it, but I ran into it when deleting an svg comment in a react component. This file will demonstrate the issue if you open it and delete the comment. It seems to have something to do with the xml namespace.

class MyComponent extends Component {
  render() {
    return (
      <div>
        {theme => {

          return (
            <svg xmlns:xlink="http://www.w3.org/1999/xlink">
              <!-- test -->
            </svg>
          )
        }
      }
      </div>
    )
  }
}
aaronjensen commented 7 years ago

I can't reproduce this w/ eslint_d 5.0.0.

It does crash eslint, which it probably shouldn't do, but that does not result in the buffer getting replaced in emacs. Note there were errors that caused this in older versions of eslint_d, but they've been fixed. If you're up to date with both eslint_d and eslintd-fix, this shouldn't happen. Please try updating and let me know if it still happens.

aaronjensen commented 7 years ago

FWIW eslint_d 4.2.4 was the first version that fixes the behavior you're describing.

RobinClowers commented 7 years ago

Yeah, I was on 4.2.1, upgrading fixed it. Thanks!