Skip to content

Instantly share code, notes, and snippets.

@jdx
Last active February 8, 2025 14:08
Show Gist options
  • Save jdx/e0e1c2470684db6e2fd33d752a2da1ff to your computer and use it in GitHub Desktop.
Save jdx/e0e1c2470684db6e2fd33d752a2da1ff to your computer and use it in GitHub Desktop.
// formatters can be used in any hook
formatters {
["cargo"] {} // defaults to "*.rs"
["go"] {} // defaults to "*.go"
["prettier"] {
glob = new { "*.ts" }
}
}
// linters can be used in any hook
linters {
["clippy"] {}
["golangci-lint"] {}
["eslint"] {
glob = new { "*.ts" }
}
}
// defines what happens during git pre-commit hook
pre_commit {
// each `new {}` listing is a group whose individual steps run in parallel
new {
// "prelint" here is simply a name to define the step
["prelint"] {
// if a step has a "run" script it will execute that
run = "mise run prelint"
}
}
new {
// as mentioned above, format+lint will run in parallel (with some logic to handle read/writes to the same file)
// "format" and "lint" are special names that run formatters/linters and don't require a "run" field
["format"] {}
["lint"] {
fix = true // will automatically apply any fixes the linters provide
}
}
new {
["postlint"] {
run = "mise run postlint"
}
}
}
pre_push {
new {
["format"] {
check = true // ensures the files have no changes and fails otherwise
}
["lint"] {} // won't fix by default, just runs the linters
}
}
// TODO
// commit_msg {
// }
// TODO
// prepare_commit_msg {
// }
// TODO
// update {
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment