Best Practices
Source files
- Use lowercase letters for directory names and filenames. Connect words with underscore, not blank space.
- Use
.html or .htm as file extension for HTML, .css for style sheets, and .js for JavaScript. - Encode files in UTF-8.
Formatting
- Use braces for all control structures.
- Use K&R style for nonempty blocks.
- Indent with 2 spaces.
- One statement per line, ending with a semicolon.
- Use 80 charcters as the column limit.
- Break a line at a higher syntactic level.
- Indent continued lines with 4 spaces.
- Use a space between reserved keywords with parenthesis and braces.
- Use a space after comma and colon.
Language features
- Do not mix quoted and unquoted keys.
- Use single quotes for ordinary strings.
- Use template literals over complex string concatenation.
Naming
- Use descriptive names for variables and functions.
- Use
camelCase instead of snake_case or kebab-case.
Style guides
Linters