Skip to content

Commit bf47d1c

Browse files
docs: husky add .husky/commit-msg docs fix (#3113)
* docs: husky add .husky/commit-msg docs fix Executing ``` npx husky add .husky/commit-msg 'npx --no -- commitlint --edit $1' yarn husky add .husky/commit-msg 'yarn commitlint --edit $1' ``` doesn't seem to produce desired .husky/commit-msg file content ``` . "$(dirname "$0")/_/husky.sh" npx --no -- commitlint --edit $1 ``` instead it produces ``` . "$(dirname "$0")/_/husky.sh" npx --no -- commitlint --edit ``` because $1 is interpolated, adding slash doesn't seem to help, hence suggested fix (fix is bit ugly I admit, up to you guys to accept it or fixing it your way) * docs: linting Co-authored-by: escapedcat <[email protected]>
1 parent 561da2c commit bf47d1c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

docs/guides-local-setup.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,13 @@ npx husky install
3737
yarn husky install
3838

3939
# Add hook
40-
npx husky add .husky/commit-msg 'npx --no -- commitlint --edit $1'
41-
# or
42-
yarn husky add .husky/commit-msg 'yarn commitlint --edit $1'
40+
cat <<EEE > .husky/commit-msg
41+
#!/bin/sh
42+
. "\$(dirname "\$0")/_/husky.sh"
43+
44+
npx --no -- commitlint --edit "\${1}"
45+
EEE
46+
4347
```
4448

4549
**Please note that currently @commitlint/cli doesn't support yarn v2 Plug'n'Play (using yarn v2 with `nodeLinker: node-modules` in your .yarnrc.yml file may work sometimes)**\

0 commit comments

Comments
 (0)