@@ -33,18 +33,18 @@ import type { GitHooksConfig } from 'bun-git-hooks'
33
33
34
34
const config: GitHooksConfig = {
35
35
// Note: stagedLint is only available in preCommit hook
36
- ' preCommit' : {
37
- ' stagedLint' : {
36
+ preCommit: {
37
+ stagedLint: {
38
38
' *.{js,ts}' : ' bunx --bun eslint . --fix' ,
39
39
' *.{css,scss}' : ' stylelint --fix'
40
40
}
41
41
},
42
- ' commitMsg' : ' bun commitlint --edit $1' ,
43
- ' prePush' : ' bun run build' ,
42
+ commitMsg: ' bun commitlint --edit $1' ,
43
+ prePush: ' bun run build' ,
44
44
45
45
// Optional settings
46
- ' verbose' : true , // Enable verbose logging
47
- ' preserveUnused' : false , // Remove unused hooks (default)
46
+ verbose: true , // Enable verbose logging
47
+ preserveUnused: false , // Remove unused hooks (default)
48
48
}
49
49
50
50
export default config
@@ -76,11 +76,11 @@ Any valid git hook can be configured with either a command string or a staged-li
76
76
``` ts
77
77
const config: GitHooksConfig = {
78
78
// Simple command
79
- ' preCommit' : ' bun run lint' ,
79
+ preCommit: ' bun run lint' ,
80
80
81
81
// Staged lint configuration (preCommit only)
82
- ' preCommit' : {
83
- ' stagedLint' : {
82
+ preCommit: {
83
+ stagedLint: {
84
84
' *.{js,ts}' : ' bunx --bun eslint . --fix' ,
85
85
' *.{css,scss}' : ' stylelint --fix'
86
86
}
@@ -94,8 +94,8 @@ The `stagedLint` feature is only available in the preCommit hook. It allows you
94
94
95
95
``` ts
96
96
const config: GitHooksConfig = {
97
- ' preCommit' : {
98
- ' stagedLint' : {
97
+ preCommit: {
98
+ stagedLint: {
99
99
// Run ESLint on JavaScript and TypeScript files
100
100
' *.{js,ts}' : ' bunx --bun eslint . --fix' ,
101
101
@@ -131,21 +131,21 @@ Some hooks receive arguments from Git that you can use in your commands:
131
131
``` ts
132
132
const config: GitHooksConfig = {
133
133
// $1 is the commit message file path
134
- ' commitMsg' : ' bun commitlint --edit $1' ,
134
+ commitMsg: ' bun commitlint --edit $1' ,
135
135
136
136
// $1 is the previous HEAD, $2 is the new HEAD
137
- ' postCheckout' : ' bun run update-deps $1 $2' ,
137
+ postCheckout: ' bun run update-deps $1 $2' ,
138
138
}
139
139
```
140
140
141
141
### Preserving Specific Hooks
142
142
143
143
``` ts
144
144
const config: GitHooksConfig = {
145
- ' preCommit' : ' bun run lint' ,
145
+ preCommit: ' bun run lint' ,
146
146
147
147
// Keep specific hooks when cleaning up
148
- ' preserveUnused' : [' postMerge' , ' postCheckout' ],
148
+ preserveUnused: [' postMerge' , ' postCheckout' ],
149
149
}
150
150
```
151
151
@@ -154,10 +154,10 @@ const config: GitHooksConfig = {
154
154
``` ts
155
155
const config: GitHooksConfig = {
156
156
// Multiple commands with &&
157
- ' preCommit' : ' bun run lint && bun run test && bun run build' ,
157
+ preCommit: ' bun run lint && bun run test && bun run build' ,
158
158
159
159
// Or using array join for better readability
160
- ' prePush' : [
160
+ prePush: [
161
161
' bun run build' ,
162
162
' bun run test:e2e' ,
163
163
' bun run deploy'
0 commit comments