Atom-beautify: Beautify rewrites boolean attributes in JSX as if they were HTML code

Created on 7 Nov 2017  路  4Comments  路  Source: Glavin001/atom-beautify

Guess this is also a problem with the latest version of PrettyDiff.

Before:

<Map animate>

This is correct, since in JSX, boolean attributes of an element should omit a value if they are "true".

After Beautification:

<Map animate="animate">

This would be ok for HTML, but breaks JSX code, as "animate" is not a valid boolean. Unfortunately, this change is not even detectable by eslint, so code that ran perfectly before breaks unexpectedly now if you rely on "Beautify on save" as I do.

Setting animate={true} as a work-around doesn't help much, as this is considered as an error by eslint.

BTW: Is there a way to revert atom-beautify to an older version without the latest PrettyDiff updates? They are causing so much trouble that I would prefer the older one until these bugs have been fixed.

stale

Most helpful comment

I am in the process of upgrading Pretty Diff to version 3 which will use an external parser. This issue is resolved in the parser, so I just need to publish an update to Pretty Diff.

All 4 comments

I am in the process of upgrading Pretty Diff to version 3 which will use an external parser. This issue is resolved in the parser, so I just need to publish an update to Pretty Diff.

Thanks. Really looking forward to this update, since it forces me to disable atom-beautify for now. The many cases it breaks JSX at the moment make it more "harmful" than "useful", at least in its current state. I'd love to see a way to revert to a previous version...

BTW: If you need volunteers testing JSX support for the next bigger update of atom-beautify, I'd be happy to support. I am using JSX nearly every day. I know this isn't trivial and appreciate your great work!

This issue has been automatically marked as stale because it has not had recent activity. If this is still an issue, please add a comment. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

philippelesaux picture philippelesaux  路  4Comments

philiplb picture philiplb  路  5Comments

callmeyesh picture callmeyesh  路  3Comments

opikhidayat picture opikhidayat  路  4Comments

kuzyn picture kuzyn  路  3Comments