Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
docs: Update documentation for husky 1.0 (#496)
  • Loading branch information
typicode authored and okonet committed Sep 23, 2018
1 parent d386c80 commit d782fa1
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions README.md
Expand Up @@ -28,9 +28,11 @@ This project contains a script that will run arbitrary shell tasks with a list o

```diff json
{
"scripts": {
+ "precommit": "lint-staged"
},
+ "husky": {
+ "hooks": {
+ "pre-commit": "lint-staged"
+ }
+ },
+ "lint-staged": {
+ "*.js": ["eslint --fix", "git add"]
+ }
Expand All @@ -50,12 +52,6 @@ See [examples](#examples) and [configuration](#configuration) below.

> I recommend using [husky](https://github.com/typicode/husky) to manage git hooks but you can use any other tool.
> **NOTE:**
>
> If you're using commitizen and having following npm-script `{ commit: git-cz }`, `precommit` hook will run twice before commitizen cli and after the commit. [This buggy behaviour is introduced by husky](https://github.com/okonet/lint-staged/issues/152#issuecomment-306046520).
>
> To mitigate this rename your `commit` npm script to something non git hook namespace like, for example `{ cz: git-cz }`
## Changelog

[releases](https://github.com/okonet/lint-staged/releases)
Expand Down Expand Up @@ -221,8 +217,12 @@ All examples assuming you’ve already set up lint-staged and husky in the `pack
"name": "My project",
"version": "0.1.0",
"scripts": {
"my-custom-script": "linter --arg1 --arg2",
"precommit": "lint-staged"
"my-custom-script": "linter --arg1 --arg2"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {}
}
Expand Down

0 comments on commit d782fa1

Please sign in to comment.