DEV Community

Discussion on: Mistakes I made in code reviews and what I do now

Collapse
 
jeriel profile image
Jeriel Ng

Great thoughts! What is your opinion on making comments to make code more concise but not exactly address a critical error?

For example, sometimes, I comment if someone is using a for loop when they could use a .map or .filter -> things that aren’t usually a big deal but could make it more readable for the next developer.

Collapse
 
wceolin profile image
Will Ceolin

@jerielng Thanks, I'm glad this post could be useful! For cases like avoiding for loops, I just use ESLint rules (and I also use husky and lint-staged for running both ESLint and Prettier as a pre-commit hook. It helps me to avoid all those nitpicking comments and keep the codebase consistent.

But I think the most important thing is talking to your co-workers to see what kind of comments they like/dislike in code reviews.