369
codeStyle (lemmy.world)
you are viewing a single comment's thread
view the rest of the comments
[-] mesamunefire@lemmy.world 46 points 8 months ago

Linters make these kind of things easier. Then you get mad at the tool rather than your coworker.

[-] flashgnash@lemm.ee 10 points 8 months ago

Does Prettier count as a linter?

I always thought linters were more to find bad practice and possible errors than control the code style

[-] Australis13@fedia.io 14 points 8 months ago

Some linters can do both. Getting one set up as an automated job whenever code is pushed to the repo is on my TODO list...

[-] mesamunefire@lemmy.world 4 points 8 months ago

Yep all my public repos have it on a ci job. When you have a library that is used on many different projects, I want to be able to read the prs.

[-] flashgnash@lemm.ee 3 points 8 months ago

That does sound nice to me too. I've found prettier with format on save works pretty well but that means you have to set it up in every editor

[-] RustyNova@lemmy.world 8 points 8 months ago

Format on save is a godsend. Copy paste something with whole indentation? Ctrl-s, it's back to normal. Did some wacky nested anonymous function calls? Ctrl-s, and they're laid out nicely.

[-] GissaMittJobb@lemmy.ml 2 points 8 months ago

I honestly almost golf my code nowadays and just let the tooling fix formatting for me. The space bar and enter key are in an ideal world vestigial for the purposes of programming.

[-] RustyNova@lemmy.world 1 points 8 months ago

I'll always say that the best code editor is the one that makes you put your idea onto a file the fastest.

So yeah, you shouldn't worry about style and code lint. You should worry if your code is sound and works. Keep your mind on the logic, not the extras

this post was submitted on 01 Mar 2024
369 points (93.2% liked)

Programmer Humor

32410 readers
341 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS