mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-02 18:56:52 +00:00
pretty-format-json: ignore original newline presence or absence
This commit is contained in:
parent
2d948977cf
commit
10e3730a81
4 changed files with 15 additions and 1 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue