From 02d3452100f97c4039aa37b63f9b55f051eff618 Mon Sep 17 00:00:00 2001 From: ClasWen Date: Sat, 18 May 2024 21:07:46 +0800 Subject: [PATCH] set up commit hook --- .husky/pre-commit | 1 + package.json | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..2312dc5 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +npx lint-staged diff --git a/package.json b/package.json index c5fde9d..f534045 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "build": "astro build", "preview": "astro preview", "lint": "eslint", - "astro": "astro" + "astro": "astro", + "prepare": "husky" }, "dependencies": { "@astrojs/react": "^3.3.1", @@ -45,5 +46,8 @@ "lint-staged": "^15.2.2", "typescript": "^5.4.5", "typescript-eslint": "^7.9.0" + }, + "lint-staged": { + "*.{js,jsx,mjs,ts,tsx,mts,astro}": "eslint --fix" } -} +} \ No newline at end of file