From 8f8ec875420ab384d5cb5a50e4a5667e5fa81348 Mon Sep 17 00:00:00 2001 From: Yorke Rhodes Date: Wed, 18 May 2022 14:32:52 -0700 Subject: [PATCH] Add prettier precommit hook (#455) --- .husky/pre-commit | 4 ++++ package.json | 4 +++- yarn.lock | 10 ++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100755 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 000000000..11daf3021 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +yarn prettier diff --git a/package.json b/package.json index a0813d16d..1dca1e034 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,8 @@ "name": "@abacus-network/monorepo", "scripts": { "build": "yarn workspaces foreach --parallel --topological run build", - "prettier": "yarn workspaces foreach --parallel run prettier" + "prettier": "yarn workspaces foreach --parallel run prettier", + "postinstall": "husky install" }, "workspaces": [ "solidity/*", @@ -13,6 +14,7 @@ "packageManager": "yarn@3.2.0", "devDependencies": { "@trivago/prettier-plugin-sort-imports": "^3.2.0", + "husky": "^8.0.0", "prettier": "^2.2.1", "typescript": "^4.3.5" } diff --git a/yarn.lock b/yarn.lock index 1881fe192..3b59021bc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -176,6 +176,7 @@ __metadata: resolution: "@abacus-network/monorepo@workspace:." dependencies: "@trivago/prettier-plugin-sort-imports": ^3.2.0 + husky: ^8.0.0 prettier: ^2.2.1 typescript: ^4.3.5 languageName: unknown @@ -9230,6 +9231,15 @@ __metadata: languageName: node linkType: hard +"husky@npm:^8.0.0": + version: 8.0.1 + resolution: "husky@npm:8.0.1" + bin: + husky: lib/bin.js + checksum: 943a73a13d0201318fd30e83d299bb81d866bd245b69e6277804c3b462638dc1921694cb94c2b8c920a4a187060f7d6058d3365152865406352e934c5fff70dc + languageName: node + linkType: hard + "iconv-lite@npm:0.4.24, iconv-lite@npm:^0.4.24": version: 0.4.24 resolution: "iconv-lite@npm:0.4.24"