-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhk.pkl
More file actions
73 lines (59 loc) · 1.87 KB
/
hk.pkl
File metadata and controls
73 lines (59 loc) · 1.87 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
amends "package://github.com/jdx/hk/releases/download/v1.42.0/hk@1.42.0#/Config.pkl"
import "package://github.com/jdx/hk/releases/download/v1.42.0/hk@1.42.0#/Builtins.pkl"
local checks = new Mapping<String, Step> {
["check_added_large_files"] = Builtins.check_added_large_files
// ["check_case_conflict"] = Builtins.check_case_conflict
["check_executables_have_shebangs"] = Builtins.check_executables_have_shebangs
["check_merge_conflict"] = Builtins.check_merge_conflict
["check_symlinks"] = Builtins.check_symlinks
["detect_private_key"] = Builtins.detect_private_key
["mixed_line_ending"] = Builtins.mixed_line_ending
["newlines"] = Builtins.newlines
["trailing_whitespace"] = Builtins.trailing_whitespace
["prettier"] = Builtins.prettier
}
local linters = new Mapping<String, Step> {
["actionlint"] = Builtins.actionlint // GitHub Actions
["hadolint"] = Builtins.hadolint // Dockerfile
["markdown_lint"] = (Builtins.markdown_lint) {
check = "markdownlint-cli2 {{files}}"
fix = "markdownlint-cli2 --fix {{files}}"
}
["shellcheck"] = Builtins.shellcheck
["sort_package_json"] = (Builtins.sort_package_json) {
prefix = "bunx"
}
["stylua"] = Builtins.stylua
["yamllint"] = Builtins.yamllint
}
local all = new Mapping<String, Step | Group> {
["pre-lint"] = new Group {
steps = checks
}
["lint"] = new Group {
steps = linters
}
}
hooks {
// "check" and "fix" are special steps for `hk check` and `hk fix` commands
["check"] {
steps = all
}
["fix"] {
fix = true
steps = all
}
["commit-msg"] {
steps {
["commitlint"] {
prefix = "bunx"
check = "commitlint --edit {{commit_msg_file}}"
}
}
}
["pre-commit"] {
fix = true // automatically modify files with available linter fixes
stash = "git" // stashes unstaged changes while running fix steps
steps = all
}
}