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

Comments

Projects
None yet
4 participants
@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

This comment has been minimized.

Show comment
Hide comment
@maksimr
Owner

maksimr commented Oct 18, 2015

maksimr added a commit that referenced this issue Oct 18, 2015

@mydearxym

This comment has been minimized.

Show comment
Hide comment
@mydearxym

mydearxym 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>
    )
  }
}

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

This comment has been minimized.

Show comment
Hide comment
@maksimr

maksimr Oct 26, 2015

Owner

@mydearxym can you put your .editorconfig

Owner

maksimr commented Oct 26, 2015

@mydearxym can you put your .editorconfig

@mydearxym

This comment has been minimized.

Show comment
Hide comment
@mydearxym

mydearxym 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

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

This comment has been minimized.

Show comment
Hide comment
@maksimr

maksimr Oct 26, 2015

Owner

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

Owner

maksimr commented Oct 26, 2015

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

@mydearxym

This comment has been minimized.

Show comment
Hide comment
@mydearxym

mydearxym Oct 26, 2015

@maksimr Nope, just the common version .

mydearxym commented Oct 26, 2015

@maksimr Nope, just the common version .

@maksimr

This comment has been minimized.

Show comment
Hide comment
@maksimr

maksimr Oct 26, 2015

Owner

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

Thanks

Owner

maksimr commented Oct 26, 2015

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

Thanks

@maksimr

This comment has been minimized.

Show comment
Hide comment
@maksimr

maksimr Jan 17, 2016

Owner

@mydearxym for jsx you should call JsxBeautify

Owner

maksimr commented Jan 17, 2016

@mydearxym for jsx you should call JsxBeautify

@mydearxym

This comment has been minimized.

Show comment
Hide comment
@mydearxym

mydearxym commented Jan 19, 2016

@maksimr thanks !

@zeroliu

This comment has been minimized.

Show comment
Hide comment
@zeroliu

zeroliu 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 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

This comment has been minimized.

Show comment
Hide comment
@zeroliu

zeroliu 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

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

This comment has been minimized.

Show comment
Hide comment
@maksimr

maksimr Jun 2, 2016

Owner

Related issue #104

Owner

maksimr commented Jun 2, 2016

Related issue #104

maksimr added a commit that referenced this issue Jul 6, 2016

Merge pull request #120 from ifokeev/master
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