Skip to content

Commit

Permalink
chore: setup husky
Browse files Browse the repository at this point in the history
  • Loading branch information
kagankan committed Aug 25, 2024
1 parent dfb3938 commit f01a7ce
Show file tree
Hide file tree
Showing 7 changed files with 658 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .commitlintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
extends: ['@commitlint/config-conventional'],
};
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
2 changes: 2 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
yarn commitlint --edit "$1"
14 changes: 14 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

# Get the current branch name
branch_name=$(git symbolic-ref --short HEAD)

# Prevent direct commits to the main or dev branch
if [ "$branch_name" = "main" ]; then
echo "Direct commits to the $branch_name branch are prohibited."
echo "Please commit to an appropriate branch and merge it instead."
exit 1
fi

yarn lint-staged
6 changes: 6 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"**/*.{ts,tsx,js,cjs,mjs,json}": ["prettier --write"],
"**/*.{ts,mjs,cjs,spec.js}": ["eslint --fix"],
".github/workflows/*.yml": ["actionlint"],
"**": ["cspell --no-must-find-files --no-progress --show-suggestions"]
}
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
"xterm": "5.3.0"
},
"devDependencies": {
"@commitlint/cli": "^19.4.0",
"@commitlint/config-conventional": "^19.2.2",
"@egoist/tailwindcss-icons": "1.8.1",
"@iconify-json/heroicons-solid": "1.1.12",
"@iconify-json/majesticons": "1.1.12",
Expand Down Expand Up @@ -60,7 +62,9 @@
"eslint-plugin-react-refresh": "0.4.9",
"eslint-plugin-testing-library": "6.3.0",
"eslint-plugin-vitest": "0.5.4",
"husky": "^9.1.5",
"jsdom": "24.1.1",
"lint-staged": "^15.2.9",
"npm-run-all2": "6.2.2",
"postcss": "8.4.41",
"prettier": "3.3.3",
Expand Down
Loading

0 comments on commit f01a7ce

Please sign in to comment.