@@ -29,19 +29,19 @@ const config: GitHooksConfig = {
29
29
30
30
You can use any glob pattern supported by Git:
31
31
32
- ``` ts
32
+ ``` json
33
33
{
34
34
// Single extension
35
- ' *.js' : ' eslint --fix' ,
35
+ " *.js" : " eslint --fix" ,
36
36
37
37
// Multiple extensions
38
- ' *.{js,ts,jsx,tsx}' : [' eslint --fix' , ' prettier --write' ],
38
+ " *.{js,ts,jsx,tsx}" : [" eslint --fix" , " prettier --write" ],
39
39
40
40
// Specific directories
41
- ' src/**/*.ts' : ' tsc --noEmit' ,
41
+ " src/**/*.ts" : " tsc --noEmit" ,
42
42
43
43
// Exclude patterns
44
- ' !(*test).ts' : ' eslint'
44
+ " !(*test).ts" : " eslint"
45
45
}
46
46
```
47
47
@@ -51,17 +51,21 @@ Commands can be specified in two ways:
51
51
52
52
1 . ** Single Command String** :
53
53
54
- ``` ts
55
- ' *.js' : ' eslint --fix'
54
+ ``` json
55
+ {
56
+ "*.js" : " eslint --fix"
57
+ }
56
58
```
57
59
58
60
2 . ** Array of Commands** :
59
61
60
- ``` ts
61
- ' *.js' : [
62
- ' eslint --fix' ,
63
- ' prettier --write'
64
- ]
62
+ ``` json
63
+ {
64
+ "*.js" : [
65
+ " eslint --fix" ,
66
+ " prettier --write"
67
+ ]
68
+ }
65
69
```
66
70
67
71
## Best Practices
@@ -75,52 +79,52 @@ Commands can be specified in two ways:
75
79
76
80
### Basic JavaScript/TypeScript Linting
77
81
78
- ``` ts
82
+ ``` json
79
83
{
80
- ' pre-commit' : {
81
- ' staged-lint' : {
82
- ' *.{js,ts}' : ' bunx --bun eslint . --fix'
84
+ " pre-commit" : {
85
+ " staged-lint" : {
86
+ " *.{js,ts}" : " bunx --bun eslint . --fix"
83
87
}
84
88
}
85
89
}
86
90
```
87
91
88
92
### Comprehensive Code Quality Checks
89
93
90
- ``` ts
94
+ ``` json
91
95
{
92
- ' pre-commit' : {
93
- ' staged-lint' : {
96
+ " pre-commit" : {
97
+ " staged-lint" : {
94
98
// Lint and format TypeScript files
95
- ' *.{ts,tsx}' : [
96
- ' bunx --bun eslint . --fix' ,
97
- ' prettier --write' ,
98
- ' tsc --noEmit'
99
+ " *.{ts,tsx}" : [
100
+ " bunx --bun eslint . --fix" ,
101
+ " prettier --write" ,
102
+ " tsc --noEmit"
99
103
],
100
104
101
105
// Style files
102
- ' *.{css,scss}' : ' stylelint --fix' ,
106
+ " *.{css,scss}" : " stylelint --fix" ,
103
107
104
108
// Markdown files
105
- ' *.md' : ' prettier --write' ,
109
+ " *.md" : " prettier --write" ,
106
110
107
111
// JSON files
108
- ' *.json' : ' prettier --write'
112
+ " *.json" : " prettier --write"
109
113
}
110
114
}
111
115
}
112
116
```
113
117
114
118
### Custom Script Integration
115
119
116
- ``` ts
120
+ ``` json
117
121
{
118
- ' pre-commit' : {
119
- ' staged-lint' : {
120
- ' *.{js,ts}' : [
121
- ' bun run test:unit' ,
122
- ' bun run lint:fix' ,
123
- ' bun run type-check'
122
+ " pre-commit" : {
123
+ " staged-lint" : {
124
+ " *.{js,ts}" : [
125
+ " bun run test:unit" ,
126
+ " bun run lint:fix" ,
127
+ " bun run type-check"
124
128
]
125
129
}
126
130
}
0 commit comments