-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON files are saved with no newline at the end of file #1382
Comments
This is being handled under #1302. We can leave this issue open since that PR doesn't have an issue. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Any update? #1302 was closed, but it seemed mostly good to go. To answer the question from @erquhart:
The POSIX definition of a text file includes that it should end with a newline character. The question is whether or not the file in question is treated as a text file. If the file is a text file, then it should have the trailing newline character. If the file does not have a trailing newline character, then by POSIX definition we can only say it is a stream of bytes, and not a text file. |
Same with YAML files. I'll add that git complains when such files don't end with newline characters, and many editors will automatically add it in again, which means diffs are going to be noisy if there's a combination of Netlify-CMS-driven edits and developer-driven edits. |
If someone would like to submit a PR for this the place to start is https://github.com/netlify/netlify-cms/blob/26cd552746d6294387b9bdd961a73d5a531bf665/packages/netlify-cms-core/src/formats/frontmatter.ts#L34 |
- Do you want to request a feature or report a bug?
Bug
- What is the current behavior?
Netlify CMS saves JSON data without a newline at the end of the file.
- If the current behavior is a bug, please provide the steps to reproduce.
Configure a collection type with
format: "json"
andextension: "json"
, then create and publish a new post in the Dashboard.- What is the expected behavior?
JSON file should created with newline at the end of the file.
The text was updated successfully, but these errors were encountered: