-
Notifications
You must be signed in to change notification settings - Fork 958
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pre-commit hook for linting and formatting
- Check linting and formatting of Typescript and Solidity files - Split linting and formatting checking on Github Actions - Refactor `NODE_VERSION` on Github Actions into an environment variable
- Loading branch information
Showing
3 changed files
with
40 additions
and
22 deletions.
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
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 |
---|---|---|
@@ -1,21 +1,21 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
# Redirect output to stderr. | ||
exec 1>&2 | ||
|
||
# prevent it.only or describe.only commited | ||
npm run lint:sol:prettier | ||
npm run lint:ts:prettier | ||
npm run lint:sol | ||
npm run lint:ts | ||
|
||
# Prevent `it.only` or `describe.only` tests commited | ||
if [ "$allowonlytests" != "true" ] && | ||
test $(git diff --cached | grep -E "\b(it|describe).only\(" | wc -l) != 0 | ||
then | ||
cat <<\EOF | ||
Error: Attempt to add it.only or describe.only - which may disable all other tests | ||
If you know what you are doing you can disable this check using: | ||
git config hooks.allowonlytests true | ||
EOF | ||
exit 1 | ||
fi | ||
|
||
exit 0 |
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