From 3640ae8985e0a6543a4abac5e5822e614ae8b381 Mon Sep 17 00:00:00 2001 From: Nabarun Gogoi <95nikass@gmail.com> Date: Wed, 6 Dec 2023 18:23:50 +0530 Subject: [PATCH] Add husky to run pre-commit lint (#3) * Run lint before commiting * Update lerna config --------- Co-authored-by: neeraj --- .husky/pre-commit | 4 ++++ lerna.json | 2 +- package.json | 5 +++++ yarn.lock | 5 +++++ 4 files changed, 15 insertions(+), 1 deletion(-) create mode 100755 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 00000000..6cdaab7b --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +yarn lint diff --git a/lerna.json b/lerna.json index 793042fd..58c60bad 100644 --- a/lerna.json +++ b/lerna.json @@ -4,5 +4,5 @@ ], "version": "0.0.0", "npmClient": "yarn", - "useWorkspaces": true + "$schema": "node_modules/lerna/schemas/lerna-schema.json" } diff --git a/package.json b/package.json index 882a42cd..44da0ee7 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,11 @@ ], "dependencies": {}, "devDependencies": { + "husky": "^8.0.3", "lerna": "^8.0.0" + }, + "scripts": { + "prepare": "husky install", + "lint": "lerna run lint --stream -- --max-warnings=0" } } diff --git a/yarn.lock b/yarn.lock index 127389f2..63adca1b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1667,6 +1667,11 @@ humanize-ms@^1.2.1: dependencies: ms "^2.0.0" +husky@^8.0.3: + version "8.0.3" + resolved "https://registry.yarnpkg.com/husky/-/husky-8.0.3.tgz#4936d7212e46d1dea28fef29bb3a108872cd9184" + integrity sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg== + iconv-lite@^0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"