From c15b17fab3c30211f8c40e033c9b3b4ea9c0ecb4 Mon Sep 17 00:00:00 2001 From: Marco Vinciguerra Date: Sat, 18 Apr 2026 15:30:42 +0200 Subject: [PATCH] chore: add pre-commit hooks with husky and lint-staged Runs biome check --write on staged JS/TS/JSON files before commit, catching formatter issues like the one that broke CI on #12. Co-Authored-By: Claude Opus 4.7 (1M context) --- .husky/pre-commit | 1 + package.json | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..ea5a55b --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +bunx lint-staged diff --git a/package.json b/package.json index 81fbd10..d971c62 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,11 @@ "test": "bun test tests/", "test:integration": "bun run integration_test.ts", "check": "tsc --noEmit && biome check .", - "prepublishOnly": "tsup" + "prepublishOnly": "tsup", + "prepare": "husky" + }, + "lint-staged": { + "*.{js,ts,jsx,tsx,json}": ["biome check --write --no-errors-on-unmatched"] }, "keywords": ["scraping", "ai", "scrapegraph", "typescript", "sdk", "web-scraping", "api"], "author": "ScrapeGraph Team", @@ -37,6 +41,8 @@ "@biomejs/biome": "^1.9.4", "@types/bun": "^1.3.9", "@types/node": "^22.13.1", + "husky": "^9.1.7", + "lint-staged": "^16.4.0", "tsup": "^8.3.6", "typescript": "^5.8.2" }