-
Notifications
You must be signed in to change notification settings - Fork 78
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
Do not remove line breaks #105
Comments
+1. I've been running into this too. |
If we want this we need to do a PR for https://github.com/Constellation/escodegen to be able to specify extra newlines above blocks. |
I have a branch called recast which uses benjamn/recast instead of escodegen/esprima If you guys want to run it and let me know what you like/don't like about it @addyosmani @albertjan @mohsen1 There are advantages and disadvantages. Some clear advantages are preservation (for the most part) of formatting and weird spacing, and I believe it has some ES6 support. The disadvantages are that ASI no longer works and neither does JSLINT's white spacing rules. I've been debating on whether or not to move forward with recast. |
I just tried recast. It's cool but it wouldn't give you empty line and comments in the AST. AST by definition shouldn't have that information. |
@goatslacker Thanks for the heads up about the recast branch. I'll be happy to try it out. Preservation of formatting would be ideal but I'll need to see how finicky the lack of white space rules not working as expected gets. Either way, appreciate you exploring this. Side: I hope we're lucky enough to see movement on estools/escodegen#203 for newlines at some point. That would definitely be better than the situation today. For now, at least in my own usage and in plugins I'm writing using fixmyjs, I'm recommending using legacy mode as a default (understanding limitations) and explaining what you get if you opt out of it as long as newline support isn't an issue. |
+1 agree with @addyosmani Please using legacy mode as a default. |
My use case is a single/infrequent usage on some legacy code. I've worked around the problem by dumping the patch file and then running a small script over the patch file to not delete the empty lines. My script produced a few issues I had to fix by hand or I'd share it. It was still much less work than doing the js cleanup by hand though. Hopefully the idea can help some of you while the issue is resolved. |
I'm closing this in favor of #110 since that issue will solve this issue. |
After fix becomes
Somehow related to #90
The text was updated successfully, but these errors were encountered: