Description
The formatter usually trims all whitespace from a line that only contains whitespace.
But it does not do that in heredocs.
For example, the formatter would remove the two white spaces between 1 and 2, but not between 3 and 4.
1
2
<<-TXT
3
4
TXT
Removing the spaces in a heredoc is entirely fine, as long as its fewer characters than the heredoc indent of the end delimiter.
Many editors would automatically trim this anyway on save.
Between 5 and 6 there are 4 spaces, but the indent is only 4 characters. So maybe should not be changed because the whitespace is part of the heredoc content.
<<-TXT
5
6
TXT
Editors' autotrim-on-save feature is usually not aware of special heredoc semantics. So in practice, this exception might be hard to use because developer tooling isn't inclined to maintain a file with an explicit whitespace-only line in a heredoc.
So it's probably fine to ignore this special case and always trim all whitespace even in heredocs.