How I Code Clean Code
Name and structure definition⌗
In a data structure it is good that each value belongs to the property of an object, therefore it is better to avoid:
- values whose meaning depends on the position in an array
- values as keys for a map or dictionary
A pattern for defining the name of the variables can be a composition in sequence of:
- Adjective
- Subject
- Type
Example:
const promotedUsersArr = [];
const enabledViewBool = false;
const badBoysNum = NaN;
The names of the methods should instead start with verbs (eg. get
, set
, write
, send
, …).
Coding⌗
/**
* TODO::
* • .editorconfig
* • .gitignore
*/
Linting⌗
/**
* TODO:
* • Eslint
* • Autoformat
*/
Testing⌗
// TODO