mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-03-29 22:38:26 +08:00
Update usage advice of husky to 1.0 (#5071)
Husky had an overhaul of the API, see https://github.com/typicode/husky Therefore the usage advice here has been adjusted.
This commit is contained in:
committed by
Joe Haddad
parent
77c32b5631
commit
eba5995b3d
@@ -326,13 +326,14 @@ yarn add husky lint-staged prettier
|
||||
|
||||
Now we can make sure every file is formatted correctly by adding a few lines to the `package.json` in the project root.
|
||||
|
||||
Add the following line to `scripts` section:
|
||||
Add the following field to the `package.json` section:
|
||||
|
||||
```diff
|
||||
"scripts": {
|
||||
+ "precommit": "lint-staged",
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
+ "husky": {
|
||||
+ "hooks": {
|
||||
+ "pre-commit": "lint-staged"
|
||||
+ }
|
||||
+ }
|
||||
```
|
||||
|
||||
Next we add a 'lint-staged' field to the `package.json`, for example:
|
||||
|
||||
Reference in New Issue
Block a user