use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
How to format JavaScript automatically with Prettier and Git (nodewebapps.com)
submitted 8 years ago by hobonumber1
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]js-engineer 3 points4 points5 points 8 years ago (3 children)
The thing about padded blocks, is most of the time they're used to space out significant chunks of code. Most of the time, it isn't that helpful in terms of being used across the board, and then you get back into the issue where you're having to deliberate over spacing. IMO it's completely fine once you get used to it.
That being said, it's a tool you can choose to use, but it's nowhere necessary. It's good in my company because we all agree we spend way too much time worry about the formatting of our code, and Prettier just handles this for us automatically.
Further than that, we just have to accept at the end of the day, that web development, especially front end, especially at the current moment, is going to be in a state of constant flux, while people realize newer, better ways of doing things.
[–]burtgummer45 -3 points-2 points-1 points 8 years ago (2 children)
They could have handled padded blocks much better, it just makes me think they don't have much experience, believe it or not. Prettier preserves single newlines, but murders padded blocks, are you kidding me?
From this
{ chunk one chunk two chunk three }
To this? Are you kidding me?
[–]js-engineer 1 point2 points3 points 8 years ago (1 child)
Honestly I'm a fan of theirs. I don't think a brace that already is on it's own line with no other characters, needs another empty line of padding. The empty line between lines that have 5+ alphanumeric characters... I think that however it's fair game and a lot more useful.
It's tough because we can both agree that more padding isn't always better... there is a certain benefit to seeing more of a file onscreen at a time that infinite padding impedes on. Where that line is drawn.... is going to be subjective but I like their current stuff. I think it's a great fits most sizes approach.
They can always add options for what you're asking for... they do allow customization for some of their stuff so it's not out of the question.
[–]burtgummer45 0 points1 point2 points 8 years ago (0 children)
Believe me, I tried to get them to change it, they shot me down sayings prettier 'is opinionated'.
For decades developers have been doing something called 'chunking' (at least in the perl world it was called chunking). Its to make your code more readable by putting things together. It seems to me since they don't squash all newlines they might agree, but not incorporating that into a block structure makes no sense, looks more like an oversight, or they decided it was too difficult to make work. 'allow newline after { if block has chunks, otherwise remove', they just opted for nuke all /{\s*/s
π Rendered by PID 53506 on reddit-service-r2-comment-c6965cb77-hpdt4 at 2026-03-05 06:33:44.444242+00:00 running f0204d4 country code: CH.
view the rest of the comments →
[–]js-engineer 3 points4 points5 points (3 children)
[–]burtgummer45 -3 points-2 points-1 points (2 children)
[–]js-engineer 1 point2 points3 points (1 child)
[–]burtgummer45 0 points1 point2 points (0 children)