# 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 # Keep fixes and formatting sequential, then fail on any remaining diagnostics. glob: "*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,json,jsonc,css,scss,less,md,mdx,yml,yaml,html,toml,graphql}" run: | pnpm exec oxlint --fix --no-error-on-unmatched-pattern {staged_files} && pnpm exec oxfmt --write --no-error-on-unmatched-pattern {staged_files} && pnpm exec oxlint --deny-warnings --no-error-on-unmatched-pattern {staged_files} stage_fixed: true commit-msg: jobs: - name: commitlint run: pnpm commitlint --edit {1}