fix: prevent pre-commit hook leaks
This commit is contained in:
22
lefthook.yml
22
lefthook.yml
@@ -2,39 +2,41 @@
|
|||||||
"$schema": "https://json.schemastore.org/lefthook.json",
|
"$schema": "https://json.schemastore.org/lefthook.json",
|
||||||
"pre-commit":
|
"pre-commit":
|
||||||
{
|
{
|
||||||
|
"fail_on_changes": "always",
|
||||||
|
"fail_on_changes_diff": true,
|
||||||
"commands":
|
"commands":
|
||||||
{
|
{
|
||||||
"format":
|
"format":
|
||||||
{
|
{
|
||||||
"glob": "*.{ts,js,tsx,jsx,css,json,html}",
|
"glob": "*.{ts,js,tsx,jsx,css,json,html}",
|
||||||
"run": "bunx oxfmt {staged_files}",
|
"run": "bunx oxfmt --check {staged_files}",
|
||||||
},
|
},
|
||||||
"lint:ts":
|
"lint:ts":
|
||||||
{
|
{
|
||||||
"glob": "*.{ts,js,tsx,jsx}",
|
"glob": "*.{ts,js,tsx,jsx}",
|
||||||
"run":
|
"run": "bunx oxlint --ignore-path .oxlintignore {staged_files} --max-warnings 0 --tsconfig ./tsconfig.json --type-aware",
|
||||||
"bunx oxlint --ignore-path .oxlintignore {staged_files} --max-warnings 0 --fix --tsconfig ./tsconfig.json --type-aware",
|
},
|
||||||
|
"go-fmt":
|
||||||
|
{
|
||||||
|
"glob": "*.go",
|
||||||
|
"run": 'files=$(gofmt -l {staged_files}); test -z "$files" || (printf "go files need formatting:\n%s\n" "$files"; exit 1)',
|
||||||
},
|
},
|
||||||
"go-fmt": { "glob": "*.go", "run": "go fmt {staged_files}" },
|
|
||||||
"go-lint":
|
"go-lint":
|
||||||
{
|
{
|
||||||
"glob": "*.go",
|
"glob": "*.go",
|
||||||
"run":
|
"run": 'printf "%s\n" {staged_files} | xargs -n1 dirname | sort -u | xargs -I{} golangci-lint run --new-from-rev=HEAD ./{}',
|
||||||
'printf "%s\n" {staged_files} | xargs -n1 dirname | sort -u | xargs -I{} golangci-lint run --new-from-rev=HEAD ./{}',
|
|
||||||
},
|
},
|
||||||
"go-test":
|
"go-test":
|
||||||
{
|
{
|
||||||
"glob": "*.go",
|
"glob": "*.go",
|
||||||
"run":
|
"run": 'printf "%s\n" {staged_files} | xargs -n1 dirname | sort -u | xargs -I{} go test -count=1 ./{}',
|
||||||
'printf "%s\n" {staged_files} | xargs -n1 dirname | sort -u | xargs -I{} go test -count=1 ./{}',
|
|
||||||
},
|
},
|
||||||
"ts-typecheck": { "glob": "*.ts", "run": "bunx tsc -p tsconfig.json --noEmit" },
|
"ts-typecheck": { "glob": "*.ts", "run": "bunx tsc -p tsconfig.json --noEmit" },
|
||||||
"build-assets": { "glob": "*.{ts,css}", "run": "bun run build:assets" },
|
"build-assets": { "glob": "*.{ts,css}", "run": "bun run build:assets" },
|
||||||
"go-build":
|
"go-build":
|
||||||
{
|
{
|
||||||
"glob": "*.go",
|
"glob": "*.go",
|
||||||
"run":
|
"run": 'printf "%s\n" {staged_files} | xargs -n1 dirname | sort -u | xargs -I{} go build -o /dev/null ./{}',
|
||||||
'printf "%s\n" {staged_files} | xargs -n1 dirname | sort -u | xargs -I{} go build -o /dev/null ./{}',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user