Code standards - bommezijn/Dating-Shreks GitHub Wiki
Written by Parvin collaborated with Nathan.
General information
We used some coding standards so we we wouldn't get all confused in each other's code. Our coding standards also directly connected to the linter we are using, which is the google linter. This linter sets the coding standards within Javascript for us. The most important coding standards are:
- Use 'single quotes'.
- Expecting a semicolon at the end;
- No unused variables .
- The use of JSDoc.
- The maximum line length of 80.
HTML
- Use of HTML5.
- The use of semantically correct HTML, using validators such as W3C validation (vscode) or w3c-validation (ATOM).
- Use of classes for repeatable elements.
- Not for styling fixes.
- Use of
id
's for unique elements. - Minimal to no use of
div
s. - Don't leave trailing spaces at the end of the line.
- elements and attributes are all lowercase.
CSS
- Avoid repetition.
- Use of css variables when using repeating colours.
JavaScript
- Use single quotes.
- Use ESLint with Google and its standards.
"extends": [
"eslint:recommended", "google"
],
/**
* @title succes refresh?
* @description description of function succesRefresh
* @param {datatype} req description of parameter
* @param {datatype} res description of parameter
*/
- Correctly type the spaces so you have a nice overview of what code is inside what.
- The maximum line length of 80.
- Require the npm packages at the start of a file.
- Use
(req, res)
instead ofrequest, response
.
Sources
Google. (2020, January 13). google/eslint-config-google. Retrieved from https://github.com/google/eslint-config-google
Google. (2019, September 2). npm: eslint-config-google. Retrieved from https://www.npmjs.com/package/eslint-config-google