From 772ccc75729288c35baee20ac045e7812860a274 Mon Sep 17 00:00:00 2001 From: Muhammed-Rahif Date: Tue, 14 Jan 2025 18:01:19 +0530 Subject: [PATCH] chore: add husky pre-commit hooks fix bits-ui components errors in badge, button and toggle --- .husky/pre-commit | 3 +++ package.json | 4 +++- pnpm-lock.yaml | 10 ++++++++++ src/lib/components/ui/badge/badge.svelte | 2 +- src/lib/components/ui/button/button.svelte | 4 ++-- src/lib/components/ui/toggle/toggle.svelte | 2 +- 6 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..15791bc --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,3 @@ +pnpm run format +pnpm run lint +pnpm run check diff --git a/package.json b/package.json index 631a218..9155e0d 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,8 @@ "deploy": "gh-pages -d www -m 'chore(gh-pages): updates' --nojekyll", "lint": "prettier --check . && eslint . && npx tsc --noEmit --project tsconfig.check.json", "format": "prettier --write .", - "tauri": "tauri" + "tauri": "tauri", + "prepare": "husky" }, "devDependencies": { "@semantic-release/changelog": "^6.0.3", @@ -54,6 +55,7 @@ "eslint-plugin-svelte": "^2.46.1", "gh-pages": "^6.3.0", "globals": "^15.14.0", + "husky": "^9.1.7", "prettier": "^3.4.2", "prettier-plugin-svelte": "^3.3.3", "prettier-plugin-tailwindcss": "^0.6.9", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f283750..ee5e317 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -132,6 +132,9 @@ importers: globals: specifier: ^15.14.0 version: 15.14.0 + husky: + specifier: ^9.1.7 + version: 9.1.7 prettier: specifier: ^3.4.2 version: 3.4.2 @@ -2418,6 +2421,11 @@ packages: resolution: {integrity: sha512-/1/GPCpDUCCYwlERiYjxoczfP0zfvZMU/OWgQPMya9AbAE24vseigFdhAMObpc8Q4lc/kjutPfUddDYyAmejnA==} engines: {node: '>=18.18.0'} + husky@9.1.7: + resolution: {integrity: sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==} + engines: {node: '>=18'} + hasBin: true + ico-endec@0.1.6: resolution: {integrity: sha512-ZdLU38ZoED3g1j3iEyzcQj+wAkY2xfWNkymszfJPoxucIUhK7NayQ+/C4Kv0nDFMIsbtbEHldv3V8PU494/ueQ==} @@ -6804,6 +6812,8 @@ snapshots: human-signals@8.0.0: {} + husky@9.1.7: {} + ico-endec@0.1.6: {} idb@7.1.1: {} diff --git a/src/lib/components/ui/badge/badge.svelte b/src/lib/components/ui/badge/badge.svelte index 405f713..35bf529 100644 --- a/src/lib/components/ui/badge/badge.svelte +++ b/src/lib/components/ui/badge/badge.svelte @@ -41,7 +41,7 @@ this={href ? 'a' : 'span'} bind:this={ref} {href} - class={cn(badgeVariants({ variant, className }))} + class={cn(badgeVariants({ variant }), className)} {...restProps} > {@render children?.()} diff --git a/src/lib/components/ui/button/button.svelte b/src/lib/components/ui/button/button.svelte index 90c90d5..759a9f9 100644 --- a/src/lib/components/ui/button/button.svelte +++ b/src/lib/components/ui/button/button.svelte @@ -54,13 +54,13 @@ {#if href} - + {@render children?.()} {:else}