Get Pretty Quick
Runs Prettier on your changed files.
Supported source control managers:
- Git
- Add more
With yarn
:
yarn add --dev prettier pretty-quick
With npm
:
npm install --save-dev prettier pretty-quick
With yarn
:
yarn pretty-quick
With npx
: (No install required)
npx pretty-quick
With npm
:
- Add
"pretty-quick": "pretty-quick"
to the scripts section ofpackage.json
. npm run pretty-quick
You can run pretty-quick
as a pre-commit hook using husky
.
yarn add --dev husky
In package.json
's "scripts"
section, add:
"precommit": "pretty-quick --staged"
Pre-commit mode. Under this flag only staged files will be formatted, and they will be re-staged after formatting.
pretty-quick
will respect your .prettierrc
and .prettierignore
files, so there's no additional setup required. Configuration files will be found by searching up the file system. .prettierignore
files are only found from the working directory that the command was executed from.