Code Formatting - TorinitTechnologies/Torinit-Coding-Guidelines GitHub Wiki
Good code formatting will make the code look good, but more importantly it will ensure that code can be easily read and understood by all developers.
We will mainly use Prettier as a formatting tool to control the structure and syntax of code, so that it is consistent across all developers. Prettier allows developers to write in their own style (e.g. using tabs or spaces), and then transform the code to match the configuration rules.
Installation
Global
Every developer should install Prettier globally:
$ npm install -g prettier
Next, find and install a plugin for Prettier in your IDE or text editor.
Most IDE plugins will have a keyboard shortcut to run prettier on whatever file you have open, but you should set your plugin to run on save so that it happens automatically and you don't forget.
Local
Prettier must be installed within each project by the lead developer. Using npm:
$ npm install --save-dev --save-exact prettier
The .prettierrc
file in the root of this repository must be copied into the project directory.
With ESLint
The AirBnB configuration we are using includes the necessary settings and plugins to ensure that Prettier ans ESlint work well together without conflict. If you have any issues, review the .eslintrc
configuration file, as well as the documentation here