How to set code look cleaner - adam-kostuch/terminal-backend GitHub Wiki
In this page you'll find code in this repo is gettomg beautified.
- What are the rules used in this repository:
- There are used double quotes (
"
) instead of single ('
) - Default tabs indents are 2 spaces
- You cannot use semicolons at the end of file
- In frontend repo there is additional rule for console logs, they are triggering error
- How are they managed:
- Prettier and eslint are the 2 extensions that are used to beautify your code.
Prettier
is mainly use to delete all unnecessary indents, quotes, marks and so on. Wheneslint
checks if the code has no errors. They are working with each other perfectly!- In order to use them you have to run
npm run format:fix
to run prettier andnpm run lint:fix
to run elint. To check if everything is formated you usenpm run format:check
andnpm run lint:check
. - After configurating your inner vscode settings (and folder
.vscode
) you can run those extensions on every file save. - Eslint and prettier have their own config files and those ending with suffix
ignore
. Those first one specifies what to look for and what should be fixed. The second ones ignore path that are not meant to be look for. - Lastly there is husky which runs all those comments before every commit ends.
- How does it work? Husky is configurated that before every commit launches
lint-staged.sh
script fromscripts
directory. That means you're safe that your code is in it's best shape before every commit push!