Update husky integration code for husky v1.0.0 (#5266)

Latest husky (version 1.0.0) moved its hooks config from the `scripts` field to a new `husky` field in `package.json` ([ChangeLog](https://github.com/typicode/husky/blob/master/CHANGELOG.md)).

The `scripts` syntax described here, although shorter, will be deprecated soon. This change replaces it with the new husky syntax.

The new syntax is already used in [precommit.md](https://github.com/prettier/prettier/blob/master/docs/precommit.md).
This commit is contained in:
Gilles Debunne authored and Ika committed 2018-10-21 23:28:19 +08:00
1 parent d1d1f17157
commit 559831d08e
1 file changed
+5 -3
+5 -3
View File
@@ -298,11 +298,13 @@ class GetStartedSection extends React.Component {
{bash`npm install pretty-quick husky --save-dev`}
</MarkdownBlock>
</div>
Then edit <code>package.json</code>:
Then add this config to <code>package.json</code>:
<MarkdownBlock>
{json({
scripts: {
precommit: "pretty-quick --staged"
husky: {
hooks: {
"pre-commit": "pretty-quick --staged"
}
}
})}
</MarkdownBlock>