Skip to content

Coding Conventions

Kenza Boulisfane edited this page Mar 7, 2020 · 4 revisions

Coding Conventions

It is very important for the development team to follow the coding conventions agreed upon to ensure very high code quality and overall consistency.

1. ESLint

ESLint is a tool that allows us to maintain code quality and enforce code conventions. It is a static code evaluator, which means that it does not actually execute the code but reads through it instead to check if all the preconfigured code conventions are followed by the developers.

Installation

  1. npm install eslint --save-dev
  2. npm install eslint-plugin-react --save-dev

Configuration

We have chosen to use the following basic coding conventions:

  1. Semicolons at the end of each line
  2. Double quotes over single quotes
  3. use const to define functions

How to run it locally

  1. To see which files need to be fixed along with exactly what errors need to be resolved, use the following command:

npm run lint

  1. To fix most of the errors (some of them need to be fixed manually):

npm run lint:fix

2. Naming Conventions

  • Folder names should start with a lower case letter.
  • Components should start with an upper case letter.
  • Object and variable declarations should always be in camel case (ex: camelCase).

3. Commit messages

  • Each commit should reference the issue it is solving. The issue number can be added to the commit message.

Clone this wiki locally