Skip to content

Commit

Permalink
Add Lefthook pre-commit configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
praseodym committed Apr 25, 2024
1 parent 2d902b2 commit 2d231ad
Show file tree
Hide file tree
Showing 4 changed files with 160 additions and 1 deletion.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,19 @@

Uitslagensoftware gebouwd door Team Urn.

Copyright © 2024 Kiesraad. Licensed under the EUPL-1.2 or later.
Copyright © 2024 Kiesraad. Licensed under the EUPL-1.2 or later.

## Project structure

Backend: `backend/`
Frontend: `frontend/`

See `README.md` in each directory for more information.

## Git pre-commit hook using Lefthook

This project uses [Lefthook] to manage the Git pre-commit hook. Lefthook will
be installed automatically when `npm install` is run in the `frontend`
directory.

[Lefthook]: https://github.com/evilmartians/lefthook
125 changes: 125 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"eslint-plugin-react-refresh": "^0.4.6",
"identity-obj-proxy": "^3.0.0",
"jsdom": "^24.0.0",
"lefthook": "^1.6.10",
"lint-staged": "^15.2.2",
"msw": "^2.2.13",
"postcss": "^8.4.38",
Expand Down
18 changes: 18 additions & 0 deletions lefthook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
assert_lefthook_installed: true

pre-commit:
parallel: true
commands:
backend-formatter:
root: "backend/"
glob: "*.rs"
run: cargo fmt
backend-linter:
root: "backend/"
glob: "*.rs"
run: cargo clippy --fix
stage_fixed: true
frontend-linter:
root: "frontend/"
glob: "*.{ts,tsx}"
run: npm run lint

0 comments on commit 2d231ad

Please sign in to comment.