ember-intl-analyzer
ember-intl-analyzer copied to clipboard
Allow configuration for final newline
Hi 👋🏼
When running ember-intl-analyzer --fix with JSON translation files, I realised that the formatter trims final newline in translation files
From what I understand by reading the code, this is due to these few lines
Parsing the JSON trims the newline
It would be great if we could add the newline back into the file :)
updatedTranslations = JSON.stringify(translations, null, 2) + '\n';
This would make the behaviour consistent with YAML translation files, since YAML.stringify adds a final newline
In case there are people relying on the newline trimming, maybe we can add this as a configuration param, what do you think?
// config
export default {
removeFinalNewline: true | false;
}
// index.js
updatedTranslations = JSON.stringify(translations, null, 2);
updatedTranslations += options.removeFinalNewline? '' : '\n';