From 64c6f5e2230f83a61f5240c1bcc075af80d2d2b3 Mon Sep 17 00:00:00 2001 From: hendraaagil Date: Thu, 2 Feb 2023 11:37:31 +0700 Subject: [PATCH] fix: multiple husky print & prettier path --- .husky/pre-commit | 4 ++++ .lintstagedrc.js | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index 5a182ef..2767fcb 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,8 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" +if [ -t 2 ]; then + exec >/dev/tty 2>&1 +fi + yarn lint-staged diff --git a/.lintstagedrc.js b/.lintstagedrc.js index a103634..b2bed11 100644 --- a/.lintstagedrc.js +++ b/.lintstagedrc.js @@ -2,9 +2,10 @@ module.exports = { // Lint & Prettify JSX and JS files "**/*.(jsx|js)": (filenames) => [ `yarn lint`, - `yarn prettier --write ${filenames.join(" ")}`, + `yarn prettier --write "${filenames.join('" "')}"`, ], // Prettify only JSON files - "**/*.(json)": (filenames) => `yarn prettier --write ${filenames.join(" ")}`, + "**/*.(json)": (filenames) => + `yarn prettier --write "${filenames.join('" "')}"`, };