Achieve quality code through modern tools and automation
Note: All of these practices also apply to pair and mob programming, code reviews & pull requests. Try to get all of the steps below working before you submit a pull request and your fellow developers will be very grateful.
Don't think of automation as just 'tests and testing'.. Automation in this context means also getting feedback from tools and technologies that can help.
- 'use strict'; Automatically gives helpful advice.
- Linting. With strong rules. This alone will give you constant feedback about poor practices.
- Tests. Lets never forget them. They provide constant feedback and advice.
- Code Coverage. Let these tools keep you honest and aim for 100% coverage at all times.
A fifth approach is to use a 'prettier' but personally the js one doesn't work for me (long discussion avoided). It might work for you however. That's OK too.
Sometimes I forget to add linting for a piece of code I am working on. And then I add it. Wow. I am usually amazed and humbled at all the things I cannot remember to do right. And each time I learn a little more about doing it right in the beginning next time :) Today for example, code coverage showed that a default parameter was untested and when I actually added a test the functionality turned out to be broken! Which I fixed. Thank you code coverage!
My linting rules as an example. I've been helped by most at one time or another.
- code: 120