-
Notifications
You must be signed in to change notification settings - Fork 40
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
Don't delete newlines in one-line files #42
Comments
👋 Hello! Thanks for submitting a issue! @Matt-Gleich will try to respond as soon as possible. |
@Matt-Gleich hey, just pinging, it's quite important for me:) |
Hey @bartekpacia! Sorry for the lack of communication here, I've been pretty busy with school work and some other work. I'll look into this over the weekend and let you know what's going on here. |
@Matt-Gleich I added more info to this issue (it still persists). I'd be very happy if it got fixed, but if you don't have time, I'll be done with my exams in ~2 weeks and then I can try to make a PR to fix this:) |
Super sorry for the lack of communication here. Just released 4.5.1 which has this fix. Thank you for the updated information and the reminder :) |
Thanks a lot! :D |
Describe the bug
In my CI, I use (or at least, I would love to use, because this very issue prevents me from doing so)
dart format -l 100 --output none --set-exit-if-changed .
to format my code. After that, I want to check if my imports are sorted usingflutter pub run import_sorter:main --exit-if-changed
. Now, it is just not possible for those two actions to complete successfully (they're mutually exclusive), and that is becauseimport_sorter
removes trailing newlines from files without anyimport ...
statements (or at least it looks like so).File 1
Example file that causes problems (i.e trailing newline is removed by
import_sorter
):File 2
Example file that works fine (i.e trailing newline is not removed by
import_sorter
):To Reproduce
dart format -l 100 .
flutter pub run import_sorter:main --no-comments
dart format -l 100 .
. A trailing newline will be there again. Yay!Expected behavior
import_sorter
should not delete the trailing newline.Useful resources
nano
)). To open a file in with TextEdit, useopen -e <file>
Meta Information:
import_sorter
Version: 4.5.0The text was updated successfully, but these errors were encountered: