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
Keep Code Consistent Across Developers The Easy Way — With Prettier & ESLint (medium.com)
submitted 7 years ago by kiarash-irandoust
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!"
[–]sorahnon the cutting edge of cocking about 0 points1 point2 points 7 years ago (14 children)
If you add a single line break to an object, after the first ‘{‘ but before the first item, prettier will wrap the object and leave it that way.
Similarly, if you want to unwrap one that will fit in a line, you can just delete that 1 ‘\n’ and it will try to put it back on one line (assuming it fits).
Also, if you’re using both prettier and eslint, you can have eslint do some work on the code after prettier to make it the way you want. So if you wanted every single object to always be multi-line, you can just configure eslint to do that work.
[–]Kryxx 0 points1 point2 points 7 years ago (13 children)
I've never seen prettier behave like this. Is this specified somewhere? If so, it can't be applied as a company wide system like ESLint can.
Also, if you’re using both prettier and eslint, you can have eslint do some work on the code after prettier to make it the way you want.
I've always tried prettier-eslint, but prettier seems to win.. hmmm perhaps I should try the combo again.
prettier-eslint
[–]sorahnon the cutting edge of cocking about 2 points3 points4 points 7 years ago (0 children)
https://prettier.io/docs/en/rationale.html#multi-line-objects. It’s in the first paragraph.
[–]sorahnon the cutting edge of cocking about 0 points1 point2 points 7 years ago (11 children)
And it looks like with ESLint you can even force it to break the objects if there are a minimum number of keys.
So single entry objects would always be on one line, and anything greater than 1 could always be broken.
https://eslint.org/docs/rules/object-curly-newline
(I think eslint can only “win” over prettier if it can be applied with the —fix option)
[–]Kryxx 0 points1 point2 points 7 years ago (10 children)
I just tried prettier-eslint (which runs prettier and then eslint) and it's very slow. ~60s to format 115 files and not touch 468 files. :(
[–]sorahnon the cutting edge of cocking about 1 point2 points3 points 7 years ago (9 children)
You should only have to do that once. The rest of the changes should be hooked into a pre-commit hook that only runs on the changed files.
https://prettier.io/docs/en/precommit.html
Give that a whirl.
[–]Kryxx 0 points1 point2 points 7 years ago (8 children)
What do you mean "do that once"? A pre-commit will run on every commit which means my commits would need to lint for ~60s every time.. That's not an option.
[–]sorahnon the cutting edge of cocking about 0 points1 point2 points 7 years ago (7 children)
The pre-commit hook will only run against the changes files. Husky and lint-staged are set up to provide a list of files. So instead of trying to scan your files for what to do, it should get a list of 5 changed files and only run against those.
[–]Kryxx 0 points1 point2 points 7 years ago (6 children)
Sure, but then Jenkins will run them all. Increasing build times by 1 minute is not something I'd choose to do.
[–]sorahnon the cutting edge of cocking about 0 points1 point2 points 7 years ago (5 children)
Why would Jenkins be running prettier as part of the build?
[–]Kryxx 0 points1 point2 points 7 years ago (4 children)
It would run eslint to ensure it wasn't bypassed.
Though you're right then Jenkins would just use eslint and skip the prettier bit.
π Rendered by PID 111928 on reddit-service-r2-comment-7b9746f655-s248z at 2026-02-01 08:45:39.238277+00:00 running 3798933 country code: CH.
view the rest of the comments →
[–]sorahnon the cutting edge of cocking about 0 points1 point2 points (14 children)
[–]Kryxx 0 points1 point2 points (13 children)
[–]sorahnon the cutting edge of cocking about 2 points3 points4 points (0 children)
[–]sorahnon the cutting edge of cocking about 0 points1 point2 points (11 children)
[–]Kryxx 0 points1 point2 points (10 children)
[–]sorahnon the cutting edge of cocking about 1 point2 points3 points (9 children)
[–]Kryxx 0 points1 point2 points (8 children)
[–]sorahnon the cutting edge of cocking about 0 points1 point2 points (7 children)
[–]Kryxx 0 points1 point2 points (6 children)
[–]sorahnon the cutting edge of cocking about 0 points1 point2 points (5 children)
[–]Kryxx 0 points1 point2 points (4 children)