Skip to content
Snippets Groups Projects
Commit 74bb4e01 authored by Giildo's avatar Giildo
Browse files

:wrench: Add husky for pre-commit

parent 142d8f86
Branches
Tags
No related merge requests found
Pipeline #289481 passed with stage
in 16 seconds
#!/bin/sh
echo "🚑️ Running pre-commit checks..."
echo ""
echo "🚨 Running lint..."
if ! pnpm lint --max-warnings=0; then
echo "🐛 Lint failed. Aborting commit."
exit 1
fi
echo "✅ Lint passed."
echo ""
echo ""
echo "🔍 Running format..."
pnpm format:silent
echo "✅ Format passed."
echo ""
branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$branch" = "develop" ] || [ "$branch" = "main" ]; then
echo ""
echo "🧪 Running unit test..."
if ! pnpm test:unit --run; then
echo "Unit test failed. Aborting commit."
exit 1
fi
echo "✅ Unit test passed."
echo ""
fi
echo ""
echo "🚑️ Pre-commit checks passed. Committing..."
exit 0
\ No newline at end of file
......@@ -20,12 +20,14 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"test:unit": "vitest",
"test:ui": "vitest --ui --coverage",
"test:coverage": "vitest --coverage",
"format": "prettier --config ../../.prettierrc.json --write src/",
"format:silent": "prettier --config ../../.prettierrc.json --log-level silent --write src/",
"lint": "eslint . --fix",
"oxlint": "oxlint . -c .oxlintrc.json --fix -D correctness --ignore-path .gitignore"
"oxlint": "oxlint . -c .oxlintrc.json --fix -D correctness --ignore-path .gitignore",
"prepare": "husky"
},
"keywords": [],
"author": "",
......@@ -39,6 +41,7 @@
"eslint": "^9.14.0",
"eslint-plugin-oxlint": "^0.11.1",
"globals": "^15.12.0",
"husky": "^9.1.6",
"oxlint": "^0.11.1",
"prettier": "^3.3.3",
"rollup-plugin-visualizer": "^5.12.0",
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment