diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..366d14b --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,2 @@ +prettier $(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g') --write --ignore-unknown +git update-index --again diff --git a/package.json b/package.json index 7c2b700..6b1d9a7 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "scripts": { "tsc": "tsc", "lint": "prettier --check . && eslint .", - "format": "prettier --write ." + "format": "prettier --write .", + "prepare": "husky" }, "exports": { ".": "./build/index.js", @@ -41,6 +42,7 @@ "@typescript-eslint/parser": "^6.21.0", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", + "husky": "^9.1.4", "prettier": "^3.2.5", "typescript": "^5.3.3" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b255b1d..35a0308 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -39,6 +39,9 @@ importers: eslint-config-prettier: specifier: ^9.1.0 version: 9.1.0(eslint@8.56.0) + husky: + specifier: ^9.1.4 + version: 9.1.4 prettier: specifier: ^3.2.5 version: 3.2.5 @@ -406,6 +409,11 @@ packages: resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} engines: {node: '>=8'} + husky@9.1.4: + resolution: {integrity: sha512-bho94YyReb4JV7LYWRWxZ/xr6TtOTt8cMfmQ39MQYJ7f/YE268s3GdghGwi+y4zAeqewE5zYLvuhV0M0ijsDEA==} + engines: {node: '>=18'} + hasBin: true + ignore@5.3.1: resolution: {integrity: sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==} engines: {node: '>= 4'} @@ -1105,6 +1113,8 @@ snapshots: has-flag@4.0.0: {} + husky@9.1.4: {} + ignore@5.3.1: {} image-size@1.1.1: