Going to second a response by another person in tfa's comments... who cares.. if it looks right in the source, and renders correctly, I don't see the problem... if it's really a problem, one could always...
console.log(`
<foo>
<bar />
</foo>
`.replace(/$[\r\n]+|[\r\n]+/g,'\n')
or create a function that replaces leading/trailing line feeds, etc with a single line feed.