timdouglas / pretty-quick

⚡ Get Pretty Quick

Home Page:https://npm.im/pretty-quick

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pretty-quick

Travis Prettier npm semantic-release License

Get Pretty Quick

Runs Prettier on your changed files.

demo

Supported source control managers:

  • Git
  • Add more

Install

With yarn:

yarn add --dev prettier pretty-quick

With npm:

npm install --save-dev prettier pretty-quick

Usage

With yarn:

yarn pretty-quick

With npx: (No install required)

npx pretty-quick

With npm:

  1. Add "pretty-quick": "pretty-quick" to the scripts section of package.json.
  2. npm run pretty-quick

Pre-Commit Hook

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"

demo

CLI Flags

--staged

Pre-commit mode. Under this flag only staged files will be formatted, and they will be re-staged after formatting.

Configuration and Ignore Files

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.

About

⚡ Get Pretty Quick

https://npm.im/pretty-quick

License:MIT License


Languages

Language:JavaScript 100.0%