From a2ad420b5e0fa671892b6c440e30e1b090463568 Mon Sep 17 00:00:00 2001 From: jums Date: Thu, 26 Jan 2023 12:04:08 +0100 Subject: [PATCH] only lint stashed lines git hooks will lint only staged lines dont use with `--fix` as it can create conflicts (see https://github.com/okonet/lint-staged/issues/62) Should provide a better DX: one may now commit a file with non staged lines without having lint complain about unstaged lines --- scripts/lint_staged | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/lint_staged b/scripts/lint_staged index 4a053cfaa8..16868f3f31 100755 --- a/scripts/lint_staged +++ b/scripts/lint_staged @@ -11,6 +11,8 @@ else if [ "$1" = "fix" ] || [ "$1" = "--fix" ]; then echo $staged | xargs npm run lint-fix else + git stash -k echo $staged | xargs npm run lint + git stash pop -q fi fi