In this lesson we'll use prettier
and lint-staged
to run prettier only on files that have been changed and committed to git. This will allow you to prettify files as you change them, and prevent massive lint only git check ins.
Install:
npm i husky lint-staged prettier -D
package.json:
"scripts": { "precommit": "lint-staged", "start": "webpack-dev-server --host 0.0.0.0 --port 3000 --hot --inline --no-info --content-base ./public" }, "lint-staged": { "*.js": [ "prettier --write", "git add" ] },