Automated code formatting keeps your code consistent and readable. It's also a great way to avoid arguments about code style (bikeshedding).
I almost never start a new project without enforcing automated code formatting.
For example, this is technically valid:
function welcome() {
console.log("hello world!") }
But it's not formatted according to standard conventions. You would normally write it like this:
function welcome() {
console.log("hello world!");
}
We're going to use Prettier to format our code. It's a popular package that will format our code automatically.
npm install -D --save-exact prettier
"format:write": "prettier --write \"src/**/*.{js,ts,json,css,md}\"",
"format:check": "prettier --check \"src/**/*.{js,ts,json,css,md}\""
If you're using VSCode, you can use the prettier plugin to auto-format your code on save. But you don't need that unless you like it (I can't live without format-on-save). The default "Notely" project should already be formatted properly, but the tests we added previously will likely need to be formatted.
Run and submit the CLI tests from the root of your repo.