Code Review is an extremely important step in developing quality applications. Here's the checklist of things to keep in mind while doing self code review and peer reviews of front-end code.
Curently few points are Angular specific so going forward I will update this blog by splitting it into 3 sections-
- Common front-end checklist
- Angular specific
- React specifics
In the meantime here's the list of good practices.
- Does the folder structure, file, functions and variables names makes sense.
- Use of small pure functions and small isolated reusable components.
- SOLID design principles.
- Follow declarative programming paradigm.
- Data communication should be only from parent to child and not vice-versa.
- Utilize typescript's static type checking.
- Go for named import of only the required functions rather than complete module.
- Make sure all static labels only goes into corresponding lang.json files.
- Avoid deep nested code.
- Avoid using unnecessary event handlers.
- Don't forget to clear timeout or unsubscribe from subscription.
- Clean up the resources on component's destroy.
- Easy to read import paths using aliases.
- No DOM manipulations from services.
- Proper separations of smart and dumb components.
- Business logic should only reside in services.
- Compulsory error handling.
- Exception handling.
- Unclear code should be documented.
- Can something from view logic be extracted in a pipe.
- Can something from service logic be extracted in a lib/util function.
- Avoid unnecessary addition of third party libraries.
- Avoid dead code, unnecessary comments or console logs.
- Follow basic accessibility guidelines.
Feel free to add your suggestions and feedback in the comments below.
- Ayush 🙂