Developers can make adjustments to their editing environments a single time.
Comments
Comment why it was coded this way and comment the thinking behind. Also include links in your comments to open issues, specifications etc.
1 2 3 4 5 6 7
var offset = 0;
if(includeLabels) { // If the labels are included we need to have a minimum offset of 20 pixels // We need to set it explicitly because of the following bug: http://somebrowservendor.com/issue-tracker/ISSUE-1 offset = 20; }
Use tools to generates API documentation from comments. JSDoc or YUIDoc
Code linting
Writing and following a style guide is a good practice but having an automated process that is enforcing it is even better.
HTML style rules
Document type
HTML5 (HTML syntax) is preferred for all HTML documents:
1
<!DOCTYPE html>
Script loading
Add your script element just before the body close tag and add them with a async attribute:
1 2 3 4 5 6 7 8 9 10
<html> <head> <linkrel="stylesheet"href="main.css"> </head> <body> <!-- body goes here -->