Skip to content

Commit

Permalink
Install lefthook (#527)
Browse files Browse the repository at this point in the history
  • Loading branch information
FloEdelmann authored Apr 5, 2024
1 parent 9aed228 commit 4beab73
Show file tree
Hide file tree
Showing 4 changed files with 166 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
dist/
lefthook-local.yaml
39 changes: 39 additions & 0 deletions lefthook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
pre-commit:
parallel: true
commands:
main-branch-check:
only:
- ref: 'main'
run: 'exit 1'
fail_text: 'Please switch to another branch before committing. Use `git switch -c <branch-name>`.'
prettier:
run: 'npx prettier {staged_files} --check --ignore-unknown'
fail_text: 'Please fix the formatting issues before committing. Use `npm run format`.'
eslint:
glob: '*.{mjs,ts}'
run: 'npx eslint {staged_files}'
fail_text: 'Please fix the ESLint issues before committing. Try `npx eslint --fix .`.'
markdownlint:
glob: '*.md'
run: 'npx markdownlint {staged_files}'
fail_text: 'Please fix the markdownlint issues before committing. Try `npx markdownlint --fix .`.'
build:
glob: 'src/**'
run: 'npm run build'
fail_text: 'Please fix the build issues before committing. Try `npm run build`.'
test:
glob: '{src,tests}/**'
run: 'npm run test'
fail_text: 'Please fix the test issues before committing. Try `npm run test:watch`.'
type-test:
glob: '{src,type-tests}/**'
run: 'npm run type-test'
fail_text: 'Please fix the type test issues before committing. Try `npm run type-test`.'
output:
- 'summary'
- 'success'
- 'failure'
- 'execution'
- 'execution_out'
- 'execution_info'
- 'skips'
125 changes: 125 additions & 0 deletions 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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"eslint-plugin-unicorn": "^52.0.0",
"jest": "^29.7.0",
"jest-extended": "^4.0.2",
"lefthook": "^1.6.8",
"markdownlint-cli": "^0.39.0",
"prettier": "3.2.5",
"ts-jest": "^29.1.2",
Expand Down

0 comments on commit 4beab73

Please sign in to comment.