forked from fluidd-core/fluidd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: adds commit validation via husky (fluidd-core#533)
Signed-off-by: Pedro Lamas <[email protected]>
- Loading branch information
1 parent
0166fff
commit 42a092f
Showing
6 changed files
with
110 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
[*.{js,jsx,ts,tsx,vue}] | ||
indent_style = space | ||
indent_size = 2 | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
trim_trailing_whitespace = true | ||
indent_size = 2 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.{js,jsx,ts,tsx,vue}] | ||
indent_style = space | ||
max_line_length = 100 | ||
|
||
[*.{md,markdown}] | ||
max_line_length = 0 | ||
trim_trailing_whitespace = false |
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,32 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
die () { | ||
cat <<'EOF' | ||
Error: Commit messages should follow the conventional commits standard, and should have a Signed-off-by line, for example: | ||
``` | ||
feat: My feature. | ||
Some description. | ||
Signed-off-by: Your Name <your email address> | ||
``` | ||
EOF | ||
|
||
exit 1 | ||
} | ||
|
||
COMMIT_MESSAGE=$(cat $1) | ||
|
||
COMMIT_HEAD="^merge.+|(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert|types)(\(.+\))?: .{1,50}" | ||
COMMIT_SIGNED_OFF="signed-off-by: .*<.*@.*>" | ||
|
||
if ! echo "$COMMIT_MESSAGE" | grep -iqE "$COMMIT_HEAD"; then | ||
die | ||
fi | ||
|
||
if ! echo "$COMMIT_MESSAGE" | grep -iqE "$COMMIT_SIGNED_OFF"; then | ||
die | ||
fi |
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,8 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
FILES_TO_LINT=$(git diff --cached --name-only --diff-filter=ACM | grep -iE "\.(js|jsx|ts|tsx|vue)$" || true) | ||
|
||
if [ -n "$FILES_TO_LINT" ]; then | ||
npx --no-install vue-cli-service lint --no-fix $FILES_TO_LINT | ||
fi |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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