forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlefthook.yml
More file actions
55 lines (53 loc) · 1.79 KB
/
lefthook.yml
File metadata and controls
55 lines (53 loc) · 1.79 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
output:
- meta
- summary
- success
- failure
- execution
- execution_out
- execution_info
- skips
pre-commit:
parallel: true
commands:
check-binaries:
tags: binaries
run: bash scripts/hooks/check-binaries.sh
sync-lockfile:
tags: lockfile
glob: "**/package.json"
run: pnpm i --lockfile-only
stage_fixed: true
lint-fix:
tags: lint
# Scope oxlint and oxfmt to just the files staged for commit — running
# `--fix .` / `--write .` across the whole monorepo on every commit is
# both slow and blurs the hook's purpose (touch files that aren't part
# of this change). Guard against empty `{staged_files}` expansion: when
# a commit touches only non-matching files (markdown, YAML), lefthook
# still invokes this hook with an empty expansion, and oxlint/oxfmt
# would default to operating on the current directory, defeating the
# scoping entirely. stage_fixed re-stages whatever the hooks modify.
glob: "*.{js,jsx,ts,tsx,mjs,cjs}"
# Mirror the ignorePatterns in .oxlintrc.json / .oxfmtrc.json at the
# hook layer. Without this, a docs-only commit expands {staged_files}
# to a single docs/** path; oxlint silently processes 0 files, then
# oxfmt exits 2 with "Expected at least one target file" and blocks
# the commit.
exclude:
- "docs/**"
run: |
if [ -n "{staged_files}" ]; then
pnpm exec oxlint --fix {staged_files} && pnpm exec oxfmt --write {staged_files}
fi
stage_fixed: true
test-and-check-packages:
tags: test-packages
env:
NX_TUI: "false"
run: pnpm run test && pnpm run check:packages
commit-msg:
commands:
commitlint:
tags: commitlint
run: pnpm commitlint --edit {1}