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

add-conversions plugin removes blank lines #97

Closed
gmoothart opened this issue Jan 27, 2021 · 3 comments · Fixed by #127
Closed

add-conversions plugin removes blank lines #97

gmoothart opened this issue Jan 27, 2021 · 3 comments · Fixed by #127
Labels
bug Something isn't working

Comments

@gmoothart
Copy link

On a run of ts-migrate against my codebase I noticed that some files were having empty lines removed. This is a deal-breaker as far as usability is concerned. I ran a pass of each plugin on the command-line and discovered that add-conversions is the culprit.

Using ts-migrate 0.1.13 from npm.

@edsrzf
Copy link
Collaborator

edsrzf commented Jan 28, 2021

This is an issue with all plugins that rely on TypeScript transforms. The underlying cause is microsoft/TypeScript#843.

I agree it's a major usability issue. I've been thinking about whether it might be possible to munge the transform output by comparing to the original text. That's essentially how I've worked around the problem in some projects I've converted, by using patch manipulation tools before committing to git.

@Rudeg Rudeg added the bug Something isn't working label Jan 28, 2021
@protoEvangelion
Copy link

protoEvangelion commented May 19, 2021

I'm also having this same issue for the jsdoc plugin. @edsrzf how did you use "patch manipulation tools" to add line breaks back?

@protoEvangelion
Copy link

I ended up writing two super simple text plugins that essentially replace \n\n with uniquely identifiable text at the start of the pipeline, & then replace that text with \n\n at the end of the pipeline. Works pretty well! https://github.com/protoEvangelion/ts-migrate/blob/tds/packages/ts-migrate-example/official-plugins/src/index.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants