Skip to content

Commit

Permalink
docs: husky add .husky/commit-msg docs fix (#3113)
Browse files Browse the repository at this point in the history
* 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 <github@htmlcss.de>
  • Loading branch information
sdzialowski-godaddy and escapedcat committed Apr 23, 2022
1 parent 561da2c commit bf47d1c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions docs/guides-local-setup.md
Expand Up @@ -37,9 +37,13 @@ npx husky install
yarn husky install

# Add hook
npx husky add .husky/commit-msg 'npx --no -- commitlint --edit $1'
# or
yarn husky add .husky/commit-msg 'yarn commitlint --edit $1'
cat <<EEE > .husky/commit-msg
#!/bin/sh
. "\$(dirname "\$0")/_/husky.sh"
npx --no -- commitlint --edit "\${1}"
EEE

```

**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)**\
Expand Down

0 comments on commit bf47d1c

Please sign in to comment.