-
Notifications
You must be signed in to change notification settings - Fork 2
Code Reviews
Spinning Idea edited this page May 13, 2022
·
4 revisions
- Does the code work?
- Description of the code status is included (eg alpha/beta/ready to ship to customers).
- Any issues known with current code included (eg any gotchas or features not working yet or things that folks should be aware of code wise).
- Code is written following the coding standards/guidelines (naming conventions followed, and files structured correctly, separation of concerns followed). - https://github.com/spinningideas/resources/wiki/Coding-Standards
- Code is in sync with existing code patterns/technologies.
- DRY. Is the same code duplicated more than twice?
- Notes on how to test the code?
- Are functions/classes/components reasonably small (less than 500 lines)?
- Code that is not used is removed (eg Remove unused packages from NPM).
- No hardcoded values, use constants values.
- Avoid multiple if/else blocks.
- No commented out code.
- No unnecessary comments: comments that describe the how.
- Add necessary comments where needed. Necessary comments are comments that describe the why.
- Use ES6 features.
- Use fat arrow instead of var that = this. Be consistent in your usage of arrow function.
- Use spread/rest operator.
- Use default values.
- Use const over let (avoid var).
- Use import and export.
- Use template literals.
- Use destructuring assignment for arrays and objects.
- Use Promises or Asyns/Await. Rejection is handled.
- Do components have defined propTypes?
- Are components right sized? (eg less than ~400 lines).
- Functional components for components that don't use state.
- No api calls in child components, api calls delegated to Pages?
- No state updates in loop
- No useless constructor
- Minimize logic in the render method
- Don’t use mixins, prefer HOC and composition
- Avoid use of lodash and moment and other large third party libraries and create functions as needed.
- Is any useful library needed and why?
- Code has no any linter errors or warnings.
- No console.logs.
- Consistent naming conventions are used (BEM, OOCSS, SMACSS, e.t.c.).
- CSS selectors are only as specific as they need to be; grouped logically.
- Is any 'CSS in JS' library was used?
- Use Hex color codes #000 unless using rgba().
- Avoid absolute positioning.
- Use flexbox.
- Avoid !important.
- Do not animate width, height, top, left and others. Use transform instead.
- Use same units for all project.
- Avoid inline styles.
- Tests are readable, maintainable, trustworthy.
- Test names (describe, it) are concise, explicit, descriptive.
- Avoid logic in your tests.
- Don't test multiple concerns in the same test.
- Cover the general case and the edge cases.
- Test the behavior, not the internal implementation.
- Use a mock to simulate/stub complex class structure, methods or async functions.
- Commits are small and divided into logical parts.
- Commits messages are small and understandable.
- Use branches for new features.
- Make sure no dist files, editor/IDE files, etc are checked in. There should be a .gitignore for that.
- Security.
- Usability.
- Code Review Checklist – To Perform Effective Code Reviews
- Code review checklist
- React code review checklist
- Checklist for reviewing your own React code
- Front-end Code Review & Validation Tools
- A guide to unit testing in JavaScript
- Unit Testing Checklist: Keep Your Tests Useful and Avoid Big Mistakes