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

Better support for ES6 #103

Closed
bookercodes opened this issue Oct 17, 2015 · 12 comments
Closed

Better support for ES6 #103

bookercodes opened this issue Oct 17, 2015 · 12 comments

Comments

@bookercodes
Copy link

@bookercodes bookercodes commented Oct 17, 2015

Consider the following JS code:

export default function() {
}

Upon running vim-jsbeautify the code is transformed into...

export 
default function() {
}

...Which is clearly erroneous.

When I run the same code through the online beautifer the code is formatted as I would expect. I suspect the jsbeautify dependency needs updating?

@maksimr
Copy link
Owner

@maksimr maksimr commented Oct 18, 2015

maksimr added a commit that referenced this issue Oct 18, 2015
@mydearxym
Copy link

@mydearxym mydearxym commented Oct 23, 2015

also turn my react code to wrong format

import React from 'react'

export default class Forbidden extends React.Component {
  render () {
    return (
      <div className="container">
        <div>
          <div>forbidden</div>
        </div>
        <div>
          <div>notAuthorized</div>
        </div>
      </div>
    )
  }
}
import React from 'react'

export
default class Forbidden extends React.Component {
    render() {
        return ( < div className = "container" >
            < div >
            < div > forbidden < /div>
        </div >
            < div >
            < div > notAuthorized < /div>
        </div >
            < /div>
    )
  }
}
@maksimr
Copy link
Owner

@maksimr maksimr commented Oct 26, 2015

@mydearxym can you put your .editorconfig

@mydearxym
Copy link

@mydearxym mydearxym commented Oct 26, 2015

@maksimr it's basically the same as README.md shows :

 ; .editorconfig

  root = true

  [**.js]
  indent_style = space
  indent_size = 4
  e4x = true

  [**.jsx]
  e4x = true
  indent_style = space
  indent_size = 4

  [**.css]
  indent_style = space
  indent_size = 4

  [**.html]
  indent_style = space
  indent_size = 4
  max_char = 78
  brace_style = expand
@maksimr
Copy link
Owner

@maksimr maksimr commented Oct 26, 2015

@mydearxym thanks. Are you use custom version of js-beautify?

@mydearxym
Copy link

@mydearxym mydearxym commented Oct 26, 2015

@maksimr Nope, just the common version .

@maksimr
Copy link
Owner

@maksimr maksimr commented Oct 26, 2015

@mydearxym try download latest version of js-beautify and set it in .editorconfig

Thanks

@maksimr
Copy link
Owner

@maksimr maksimr commented Jan 17, 2016

@mydearxym for jsx you should call JsxBeautify

@mydearxym
Copy link

@mydearxym mydearxym commented Jan 19, 2016

@maksimr thanks !

@zeroliu
Copy link

@zeroliu zeroliu commented Jun 2, 2016

I'm experiencing the same issue.

export default foo is turned into

export
default foo

Here's my .editorconfig:

root = true

[**.js]
indent_style = space
indent_size = 2
max_char = 80

[**.json]
indent_style = space
indent_size = 2

[**.jsx]
e4x = true
indent_style = space
indent_size = 2

[**.css]
indent_style = space
indent_size = 2

[**.html]
indent_style = space
indent_size = 2
@zeroliu
Copy link

@zeroliu zeroliu commented Jun 2, 2016

ah, manually checkout the latest version of js-beautify works. The submodule used in vim-jsbeautify is out of date.

cd ~/.vim/bundle/vim-jsbeautify/plugin/lib && git checkout master

@maksimr maksimr added the invalid label Jun 2, 2016
@maksimr maksimr closed this Jun 2, 2016
@maksimr
Copy link
Owner

@maksimr maksimr commented Jun 2, 2016

Related issue #104

maksimr added a commit that referenced this issue Jul 6, 2016
js-beautify 1.6.3 support fix #103 #104
@maksimr maksimr removed the invalid label Jul 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.