Opened 2 days ago

Last modified 31 hours ago

#36177 new Cleanup/optimization

Add a newline to the end of file when generating JSON fixtures

Reported by: Tom Carrick Owned by:
Component: Core (Management commands) Version: dev
Severity: Normal Keywords:
Cc: Tom Carrick, Trey Hunner Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Mostly I'd like to get rid of https://github.com/django/django/blob/0bac41fc7e4a842e8d20319cba31cc645501c245/.editorconfig#L24

It's a little annoying to work with in preparation for adding a CSS / JS formatter. While it won't run on JSON (yet?) it does complain about this line at the moment, and it feels a little awkward to have it in the first place.

It could also be useful if people like to concatenate fixtures to avoid getting the last } of one fixture on the same line as { of the next, and to avoid potential terminal issues around printing stuff without trailing newlines.

Another possibility is to actually format JSON files, which might be nice, and just add these newlines after the fact. If that seems like the better option, it's also fine.

Change History (1)

comment:1 by Sarah Boyce, 31 hours ago

Cc: Trey Hunner added
Triage Stage: UnreviewedAccepted

This appears to have been added in #22463, in the ticket description it appears to want new lines at the end of files. I can't find much specific discussion around JSON files
There seems to be a little discussion around not wanting a new line in #13182

Interestingly, when adding the .editorconfig to djangoproject.com this didn't have insert_final_newline = ignore

I will tentatively accept

Note: See TracTickets for help on using tickets.
Back to Top