Pretty Quick (evacuated from NSA/Microsoft Github)

Mario Pareja ea58162d4f feat: safer handling of partially staged files (with fix) (#33) пре 6 година
__mocks__ 449a863a56 test: add git tests пре 6 година
bin ea58162d4f feat: safer handling of partially staged files (with fix) (#33) пре 6 година
img eaba978435 docs: add images to project пре 6 година
src ea58162d4f feat: safer handling of partially staged files (with fix) (#33) пре 6 година
.babelrc 959e814af6 feat: do the thing пре 6 година
.eslintrc.yml 959e814af6 feat: do the thing пре 6 година
.gitignore 959e814af6 feat: do the thing пре 6 година
.prettierignore 959e814af6 feat: do the thing пре 6 година
.prettierrc.yml 959e814af6 feat: do the thing пре 6 година
.travis.yml 64228566cf chore: fixup semantic-release пре 6 година
LICENSE 9124f11bc5 chore: add release things пре 6 година
README.md ea58162d4f feat: safer handling of partially staged files (with fix) (#33) пре 6 година
package.json fca12640cd feat: add mercurial support (#5) пре 6 година
yarn.lock 449a863a56 test: add git tests пре 6 година

README.md

pretty-quick

Travis Prettier npm semantic-release License

Get Pretty Quick

Runs Prettier on your changed files.

demo

Supported source control managers:

  • Git
  • Mercurial

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.

For Mercurial have a look at husky-hg

yarn add --dev husky

In package.json's "scripts" section, add:

"precommit": "pretty-quick --staged"

demo

CLI Flags

--staged (only git)

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

Partially staged files will not be re-staged after formatting and pretty-quick will exit with a non-zero exit code. The intent is to abort the git commit and allow the user to amend their selective staging to include formatting fixes.

--branch

When not in staged pre-commit mode, use this flag to compare changes with the specified branch. Defaults to master (git) / default (hg) branch.

Configuration and Ignore Files

pretty-quick will respect your .prettierrc, .prettierignore, and .editorconfig 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.