-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhusky-hooks.config.js
59 lines (53 loc) · 1.48 KB
/
husky-hooks.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
const config = {
hooks: {
'pre-commit': [
['run-cmd', 'yarn lint'],
['run-cmd', 'yarn format'],
'check-branch',
'check-lock-files',
],
'pre-push': [
['run-cmd', 'tsc'],
['run-cmd', 'yarn lint'],
'check-branch',
'check-lock-files',
],
},
settings: {
/**
* check-branch
*
* Check which git branch we're currently on, and abort if it's a
* protected branch. This can be useful to make sure that commits stay
* away from branches that only being used for Pull Requests or CI/CD.
*/
'check-branch': {
// Git branches that should be protected from accidental commit or push
protectedBranches: ['main'],
},
/**
* check-lock-files
*
* Check for package manager lock files, and abort if any are present
* lock file that we don't want. This is useful to ensure that e.g.
* only yarn.lock is present in the repository.
*/
'check-lock-files': {
// Package manager lock file that should be present in the repository
allowLockFile: 'yarn.lock',
// Package manager lock files that should yield a abort
denyLockFiles: ['package-lock.json', 'pnpm-lock.yaml'],
},
/**
* test-sleep
*
* This is a dummy hook for demo purposes. It sleeps for 1000 seconds
* before continuing to next hook.
*/
'test-sleep': {
// How long should the hook sleep for
delay: 1000,
},
},
}
module.exports = config