How to preserve newlines at end of files when pushing to orgs with sfdx?
We avoid the issue by making git our source of truth, doing our code development in IDEA with Illuminated Cloud 2 and not retrieving code from our scratch orgs. We only retrieve non-code metadata such as flows, layouts and lightning flexipages and do this very selectively using IC2's retrieval mechanisms.