4 ms·
Consistency is key. Follow the style that the code already uses. For new apps, I make sure the team has the same style template and use the editor to format the
by brixon 8y ago
Consistency is key. Follow the style that the code already uses. For new apps, I make sure the team has the same style template and use the editor to format the page.
At the end of the day, it is important that the code looks like it was written by one consistent person and not 20 random different people.
- emodendroket 8y agoUnless the code you're working on combines different styles not only in the same project bet even in the same file.
- deckard1 8y agopet peeve #1 right here. I really don't like the mandatory use of eslint (used as style enforcement), prettier, etc. When used as a bat to hit developers over the head, all this tells me is that the organization has too many anti-social developers that can't check their ego at the door. Often someone will recommend a tool or technology in place of simple social common sense. If a developer can't follow the existing code style, they should be shunned. It's their problem. It's not a problem to solve with a fancy tool. You solve this particular problem by telling that person that they are an asshole. Using technology to solve social problems just exacerbates the problem. All of that leads to a situation where we can't have nice things. You go into a codebase and see hundreds of exceptions to turn off eslint or whatever. Instead of just working around one-off style exceptions with common sense (who really gives a damn if a line needs broken/indented a certain way for a specific function) you have to plead with the style cops to let you off each and every time. Developers really hate each other. Small organizations or teams tend to be a bit better in my experience. There is more camaraderie. But I often feel like I'm in a group of mercenaries, each ready to stab you in the back.
- britch 8y agoLinters save so much formatting time, I don't really see what it has to do with ego. I certainly could go through and make sure all the spacing is exactly right, the functions/properties are in the right place, and rest of the rules of the styleguide are followed. But it's much easier to do when you get a warning, squiggly, or can use an autoformatter to match the rules. I would never intentionally violate a rule, but I might forget a rule or miss a violation. With linters this is not an issue, the machine will let you know. Everyone can focus on the correctness and quality of code and let the machine worry about making sure everything is formatted correctly. Clearly the project you describe, where linting is disabled every other line is bad. But I wouldn't blame the linter for that. I don't know what can be done if a team has such a commitment to their own style that they put in the extra work to disable the linter. A linter is not a tool for punishing people who violate a style guide, it's an assistant for people who are trying to follow a style guide.