-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Expand file tree
/
Copy pathlefthook.yml
More file actions
38 lines (36 loc) · 1.46 KB
/
Copy pathlefthook.yml
File metadata and controls
38 lines (36 loc) · 1.46 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
# Lefthook configuration
# https://github.com/evilmartians/lefthook
pre-commit:
parallel: true
jobs:
- name: check merge conflict markers
glob: "*"
exclude:
- "*.md"
- "*.mdx"
# Single quotes only: on Windows the script is truncated at the first double quote, which
# leaves the shell with an unterminated command and fails the job on every commit.
# grep exits 1 for a clean tree and 2 on error, so the statuses are handled separately —
# an unreadable path must fail the job rather than read as no markers found.
run: |
grep -nEI '<{7} |>{7} |^={7}$' {staged_files}
status=$?
if [ $status -eq 1 ]; then
exit 0
elif [ $status -ne 0 ]; then
exit $status
fi
echo 'Error: merge conflict markers found in staged files'
exit 1
- name: lint and format
# Every extension Biome is configured to handle here. `mts`/`cts` also cover the `d.mts`/
# `d.cts` declaration files, and `css` matters because biome.json enables the CSS parser
# with Tailwind directives — those files were previously formatted only by a full `pnpm
# check`, never on commit.
glob: "*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,json,jsonc,css}"
run: pnpm biome check --write --unsafe --no-errors-on-unmatched --files-ignore-unknown=true {staged_files}
stage_fixed: true
commit-msg:
jobs:
- name: commitlint
run: pnpm commitlint --edit {1}