-
Notifications
You must be signed in to change notification settings - Fork 259
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
Find a way to support JSX until the JS-beautify library does #300
Comments
@victorporof did you try https://github.com/jdc0589/JsFormat It indents ES6 quite nicely. I use it for ES6 projects together with Sublime-HTMLPrettify (they have different keyboard shortcuts). In this case I use Sublime-HTMLPrettify for HTML/CSS/LESS and JsFormat for ES6 files. |
There is a setting in the HTML-CSS-JS Prettify plugin that allows you to ignore xml syntax in the js/jsx file. That way it doesn't mess up the jsx code. The setting is: "e4x": true in the "js" section of the settings file Go to: Preferences > Package Settings > HTML\CSS\JS Prettify > Set Prettify Preferences Add "jsx" to the "allowed_file_extension", and then change "ex4" to "true" |
@yashvekaria it doesn't work for me |
@yashvekaria 's solution works for me. |
@victorporof - js-beautify does support jsx. As @yashvekaria noted, setting |
I've tried @yashvekaria 's solution, and the package still mangles the HTML code in my JSX files. Is it maybe something to do with the version of js-beautify? I don't have it installed globally, and digging in this packages contents, the bundled version seems to be 1.6.2. Latest as of today is 1.6.4, which includes a fix for some JSX formatting: beautifier/js-beautify#914 |
#374 updates jsbeautifyrc to the latest version, possibly fixing this issue for everyone. Please reopen if not. |
Hi, I think it would be better if JSX can also be formatted (like with indentation). AS of the moment, what e4x=true only bypass codes and not actually linting it in indentation. |
Support for JSX is now enabled by default!! https://github.com/victorporof/Sublime-HTMLPrettify/releases |
I'm sure there's formatted out there that support jsx. We could potentially use those when detecting jsx syntax, until support is added to js-beautify.
The text was updated successfully, but these errors were encountered: