This repository has been archived by the owner on Mar 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: create githooks to check formatting and linting (#56)
* chore: pre-commit and pre-push hooks added * docs: removed yarn lint from PR template
- Loading branch information
1 parent
cd5b208
commit 41f51f9
Showing
3 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh | ||
|
||
CYAN='\033[0;36m' | ||
NC='\033[0m' # No Color | ||
RED='\033[0;31m' | ||
|
||
# Check that the code is formatted in the given directory provided in the first argument | ||
function check_prettier { | ||
if ! yarn prettier:check; then | ||
echo "${RED}Commit error! Cannot commit unformatted code!${NC}" | ||
echo "Prettier errors found. Please format the code via ${CYAN}yarn prettier:fix${NC}!" | ||
exit 1 | ||
fi | ||
} | ||
|
||
check_prettier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh | ||
|
||
CYAN='\033[0;36m' | ||
NC='\033[0m' # No Color | ||
RED='\033[0;31m' | ||
|
||
# Checking that the code is linted and formatted in the given directory provided in the first argument | ||
function check_lint { | ||
if ! yarn lint:check; then | ||
echo "${RED}Push error! Cannot push unlinted code!${NC}" | ||
echo "Lint errors found. Please lint the code via ${CYAN}yarn lint:fix${NC} and/or fix the errors manually!" | ||
exit 1 | ||
fi | ||
} | ||
|
||
check_lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters