I'm implementing a code review process, among the things to be reviewed is javascript. I've been asked to make a sort of checklist of things to look for when reviewing code. So far my checklist is as follows:
- no functions or variables in the global namespace.
- write efficient code, especially in loops
- don't append to the dom in a loop.
- keep style in css, use classes.
- use the best jQuery selector possible.
- Don't select an object in jquery more than once, use chaining or put it in a variable.
- minimize http requests.
- don't use jQuery $.each.
- validate user input before making http requests.
- handle specific errors.
- provide the user with enough info to remedy the situation when errors occur (if possible)
Does anyone have anything else they'd recommend for a general javascript review checklist (jQuery included).