Skip to content

Commit

Permalink
chore: add pre commit that lints project on commit
Browse files Browse the repository at this point in the history
  • Loading branch information
SverreNystad committed Sep 9, 2024
1 parent 2825dc3 commit 5894e80
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/manuals/developer_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ Then, you can start the database and the application with the following commands
source start-database.sh
```

### Pre-commit hooks

To ensure the quality of the codebase, we use pre-commit hooks to run linting and formatting checks before committing the code. This will help to catch any issues early and maintain a consistent code style.

```bash
ln -s ../../scripts/pre-commit .git/hooks/pre-commit
```

## Usage
To run the project, you can use the following commands:
```bash
Expand Down
10 changes: 10 additions & 0 deletions scripts/pre-commit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
# Run linter on staged JavaScript, TypeScript files
npx next lint --fix

if [ $? -ne 0 ]; then
echo "Linting failed. Please fix the issues before committing."
exit 1
fi

exit 0

0 comments on commit 5894e80

Please sign in to comment.