Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1,24 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

echo "Running pre-commit checks..."

# Run lint-staged for code formatting and linting
echo "Running lint-staged..."
pnpm lint-staged

# Run build to ensure project builds successfully
echo "Running build checks..."
pnpm build || {
echo "❌ Build failed. Please fix the build errors before committing."
exit 1
}

# Run tests to ensure all tests pass
echo "Running tests..."
pnpm test || {
echo "❌ Tests failed. Please fix the failing tests before committing."
exit 1
}

echo "✅ All checks passed!"
6 changes: 4 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@ This project and everyone participating in it is governed by our Code of Conduct

- `pnpm lint`: Lints the staged files using ESLint
- `pnpm format`: Formats the staged files using Prettier
- `pnpm build`: Ensures the project builds successfully
- `pnpm test`: Ensures all tests pass

If either of these commands fails due to linting errors or formatting issues, the commit will be aborted. Please fix the reported issues and try committing again.
If any of these commands fails, the commit will be aborted. Please fix the reported issues and try committing again.

You can also run the lint and format commands manually at any time:

Expand Down Expand Up @@ -164,4 +166,4 @@ This project and everyone participating in it is governed by our Code of Conduct
3. Update changelog entries
4. Tag releases appropriately

Thank you for contributing to MyCoder! 👍
Thank you for contributing to MyCoder! 👍
Loading