pretty-format-json: ignore original newline presence or absence

This commit is contained in:
Aurélien Joga 2024-03-14 10:49:51 +01:00
parent 2d948977cf
commit 10e3730a81
No known key found for this signature in database
4 changed files with 15 additions and 1 deletions

View file

@ -27,7 +27,8 @@ def _get_pretty_format(
indent=indent,
ensure_ascii=ensure_ascii,
)
return f'{json_pretty}\n'
finisher = '\n' if contents.endswith('\n') else ''
return f'{json_pretty}{finisher}'
def _autofix(filename: str, new_contents: str) -> None: