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

Javascript Layer - jsbeautify editorconfig conflicts #4211

Closed
gregpardo opened this issue Dec 17, 2015 · 6 comments
Closed

Javascript Layer - jsbeautify editorconfig conflicts #4211

gregpardo opened this issue Dec 17, 2015 · 6 comments

Comments

@gregpardo
Copy link

This might be out of scope since editorconfig is not a layer anymore.

This issue is that when editorconfig is being used jsbeautify I believe editorconfig configuration should override whatever default jsbeautify indents and formatting are. Looking for input and thoughts on this. If this sounds reasonable I could probably hack it in. Thanks

@StreakyCobra
Copy link
Contributor

It would be much more helpful if you can give us more informations. See this.

@gregpardo
Copy link
Author

Description

With editorconfig installed, jsbeautify ignores formatting rules set in the '.editorconfig' file. For example if you have tabs set to 2 spaces in .editorconfig file and you press 'SPC m =', jsbeautify will ignore the rules set in the editorconfig. Indentation with with 'SPC j =' does use the correct indent rules from editorconfig.

Reproduction guide

  • Add 'editorconfig' to dotspacemacs-additional-packages in .spacemacs
  • Install editorconfig 'brew install editorconfig'
  • Start Emacs
  • Create an .editorconfig file to a project
[*.js]
indent_style = space
indent_size = 2
  • Open a javascript file in that folder
  • Make sure editorconfig is enabled with (editorconfig-mode t)
  • Indent with 'SPC j =' (will use editorconfig rules)
  • Beautify with 'SPC m =' (will ignore editorconfig rules)
  • Notice they have different behavior with their rulesets

System Info

  • OS: darwin
  • Emacs: 24.5.1
  • Spacemacs: 0.105.0
  • Spacemacs branch: develop (rev. fbc6bc5)
  • Distribution: spacemacs
  • Layers:
(auto-completion better-defaults emacs-lisp git markdown org syntax-checking version-control osx javascript themes-megapack react)

@StreakyCobra
Copy link
Contributor

I'm not used to javascript, but if I understand correctly jsbeautify is an external tool right?

Nevermind, I looked in the code, it's the web-beautify package that providing this functionality, and it's indeed using an external tool. If you want editorconfig parameters to be supported, it's a functionality you should ask upstream. As you said Spacemacs already works with the editorconfig packages and SPC j =.

@gregpardo
Copy link
Author

Looks like someone else had the same idea

beautifier/js-beautify#551

@Delapouite
Copy link

Option support for editorconfig has been added to js-beautify: beautifier/js-beautify@9e2dcca

@d12frosted
Copy link
Contributor

@Delapouite thanks for heads up! Closing this issue as fixed upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants