Atom text editor remove trailing whitespace on save

On global level this can be changed using settings in Whitespace package, but if you want to disable it for a specific language you have to use syntax-scoped properties in your config.cson.

'.text.html.php': # php overrides
  whitespace:
    ensureSingleTrailingNewline: false
    removeTrailingWhitespace: false

'.source.ruby': # ruby overrides
  whitespace:
    ensureSingleTrailingNewline: false
    removeTrailingWhitespace: false

To see the scope of language go to Packages tab and search for your language.

Click on the settings of the language package and you can see the scope:


Under your Atom Preferences go to Packages tab and search for whitespace. Click on the whitespace package and uncheck Ensure Single Trailing Newline option

enter image description here