From 99915d3963384b645262287fb6e51dc26a4b527f Mon Sep 17 00:00:00 2001 From: "Thang X. Vu" Date: Sun, 9 Apr 2023 21:51:42 +0700 Subject: [PATCH] chore: add hook for checking files format --- .husky/pre-commit | 4 ++++ package.json | 3 +++ yarn.lock | 10 ++++++++++ 3 files changed, 17 insertions(+) create mode 100644 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 00000000..9e2e0aad --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +yarn check-format diff --git a/package.json b/package.json index 139f8bc1..8bbc1015 100644 --- a/package.json +++ b/package.json @@ -13,13 +13,16 @@ "clean": "npx lerna run clean", "test": "npx lerna run --no-bail --verbose test", "prettify": "npx prettier --write \"{packages,scripts}/{**/*,*}.{js,ts,jsx,tsx,json}\"", + "check-format": "npx prettier --check \"{packages,scripts}/{**/*,*}.{js,ts,jsx,tsx,json}\"", "version": "yarn generate-package-info-file", "prepublishOnly": "yarn copy-files-to-dist", + "postinstall": "husky install", "generate-package-info-file": "lerna exec -- node \\$LERNA_ROOT_PATH/scripts/generate-package-info-file.js", "copy-files-to-dist": "lerna exec -- node \\$LERNA_ROOT_PATH/scripts/copy-files-to-dist.js" }, "devDependencies": { "@trivago/prettier-plugin-sort-imports": "^4.1.1", + "husky": "^8.0.3", "jsdom": "^21.1.0", "lerna": "^6.5.1", "prettier": "^2.8.4", diff --git a/yarn.lock b/yarn.lock index 9a5a69f6..0e224f07 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3736,6 +3736,7 @@ __metadata: resolution: "coong-wallet@workspace:." dependencies: "@trivago/prettier-plugin-sort-imports": ^4.1.1 + husky: ^8.0.3 jsdom: ^21.1.0 lerna: ^6.5.1 prettier: ^2.8.4 @@ -5367,6 +5368,15 @@ __metadata: languageName: node linkType: hard +"husky@npm:^8.0.3": + version: 8.0.3 + resolution: "husky@npm:8.0.3" + bin: + husky: lib/bin.js + checksum: 837bc7e4413e58c1f2946d38fb050f5d7324c6f16b0fd66411ffce5703b294bd21429e8ba58711cd331951ee86ed529c5be4f76805959ff668a337dbfa82a1b0 + languageName: node + linkType: hard + "hyphenate-style-name@npm:^1.0.3": version: 1.0.4 resolution: "hyphenate-style-name@npm:1.0.4"