Skip to content

Commit

Permalink
build(git): lint commits before creating them
Browse files Browse the repository at this point in the history
Lint using Commitlint, running via Git hooks installed with Husky. This
was done with the following commands:

```shell
npm install --save-dev @commitlint/{cli,config-conventional}
echo "module.exports = { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
npm install --save-dev husky
npm pkg set scripts.prepare="husky install"
npm run prepare
npm pkg set scripts.commitlint="commitlint --edit"
npx husky add .husky/commit-msg 'npm run commitlint ${1}'
```

Lint within VS Code using the recommended extension in the .vscode directory.

Issues: #18
  • Loading branch information
geoffreyvanwyk committed Jan 5, 2024
1 parent dc5e8b5 commit 7d57c1f
Show file tree
Hide file tree
Showing 7 changed files with 2,233 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run commitlint ${1}
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"joshbolduc.commitlint"
]
}
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"cSpell.words": [
"commitlint"
]
}
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {extends: ['@commitlint/config-conventional']};
Loading

0 comments on commit 7d57c1f

Please sign in to comment.