@@ -14,9 +14,9 @@ Here's a basic `hk.pkl` file:
1414amends "package://github.com/jdx/hk/releases/download/v0.7.0/hk@0.7.0#/Config.pkl"
1515import "package://github.com/jdx/hk/releases/download/v0.7.0/hk@0.7.0#/builtins.pkl"
1616
17- local linters = new {
17+ local linters = new Mapping<String, Step> {
1818 // linters can be manually defined
19- ["eslint"] {
19+ ["eslint"] = new LinterStep {
2020 // the files to run the linter on, if no files are matched, the linter will be skipped
2121 // this will filter the staged files and return the subset matching these globs
2222 glob = List("*.js", "*.ts")
@@ -100,7 +100,7 @@ A command to run that modifies files. This typically is a "fix" command like `es
100100
101101``` pkl
102102local linters = new Mapping<String, Step> {
103- ["prettier"] {
103+ ["prettier"] = new LinterStep {
104104 fix = "prettier --write {{files}}"
105105 }
106106}
@@ -122,7 +122,7 @@ If true, hk will run the linter on batches of files instead of all files at once
122122
123123``` pkl
124124local linters = new Mapping<String, Step> {
125- ["eslint"] {
125+ ["eslint"] = new LinterStep {
126126 batch = true
127127 }
128128}
@@ -140,7 +140,7 @@ If set, run the linter on workspaces only which are parent directories containin
140140
141141``` pkl
142142local linters = new Mapping<String, Step> {
143- ["cargo-clippy"] {
143+ ["cargo-clippy"] = new LinterStep {
144144 workspace_indicator = "Cargo.toml"
145145 }
146146}
@@ -152,7 +152,7 @@ If set, run the linter scripts with this prefix, e.g.: "mise exec --" or "npm ru
152152
153153``` pkl
154154local linters = new Mapping<String, Step> {
155- ["eslint"] {
155+ ["eslint"] = new LinterStep {
156156 prefix = "npm run"
157157 }
158158}
@@ -199,8 +199,10 @@ A list of steps that must finish before this step can run.
199199``` pkl
200200hooks {
201201 ["pre-commit"] {
202- ["prettier"] {
203- depends = List("eslint")
202+ steps = new Mapping<String, Step> {
203+ ["prettier"] = new LinterStep {
204+ depends = List("eslint")
205+ }
204206 }
205207 }
206208}
@@ -225,8 +227,10 @@ A list of steps that must finish before this step can run.
225227``` pkl
226228hooks {
227229 ["pre-commit"] {
228- ["prettier"] {
229- depends = List("eslint")
230+ steps = new Mapping<String, Step> {
231+ ["prettier"] = new LinterStep {
232+ depends = List("eslint")
233+ }
230234 }
231235 }
232236}
@@ -239,8 +243,10 @@ A list of globs of files to add to the git index after running a fix step.
239243``` pkl
240244hooks {
241245 ["pre-commit"] {
242- ["prettier"] {
243- stage = List("*.js", "*.ts")
246+ steps = new Mapping<String, Step> {
247+ ["prettier"] {
248+ stage = List("*.js", "*.ts")
249+ }
244250 }
245251 }
246252}
@@ -257,14 +263,16 @@ If true, this step will wait for any previous steps to finish before running. No
257263``` pkl
258264hooks {
259265 ["pre-commit"] {
260- ["prelint"] {
261- exclusive = true // blocks other steps from starting until this one finishes
262- run = "mise run prelint"
263- }
264- // ... other steps will run in parallel ...
265- ["postlint"] {
266- exclusive = true // wait for all previous steps to finish before starting
267- run = "mise run postlint"
266+ steps = new Mapping<String, Step> {
267+ ["prelint"] {
268+ exclusive = true // blocks other steps from starting until this one finishes
269+ run = "mise run prelint"
270+ }
271+ // ... other steps will run in parallel ...
272+ ["postlint"] {
273+ exclusive = true // wait for all previous steps to finish before starting
274+ run = "mise run postlint"
275+ }
268276 }
269277 }
270278}
0 commit comments