From 5a3f3c85ddc6b76377290a930cd70ed37735d8e8 Mon Sep 17 00:00:00 2001 From: Eduardo Formiga Date: Wed, 15 Mar 2023 17:12:54 -0300 Subject: [PATCH] Fix: husky pre-commit script + Lint-stage (#1669) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What's the purpose of this pull request? Fix husky + lint-staged that runs pre-commit lints for core packages. |Before|After| |-|-| |Screenshot 2023-03-15 at 16 57 30|Screenshot 2023-03-15 at 16 57 37| Should should also see this scripts running pre commits: Screenshot 2023-03-15 at 17 05 06 ## How to test it? - run `yarn` command. - you should see the pre commit lint tasks after a commit as well 😉 ## references https://github.com/typicode/husky/issues/851 --- packages/core/.husky/pre-commit | 2 +- packages/core/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/.husky/pre-commit b/packages/core/.husky/pre-commit index d2ae35e84b..bc213b7d50 100755 --- a/packages/core/.husky/pre-commit +++ b/packages/core/.husky/pre-commit @@ -1,4 +1,4 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -yarn lint-staged +cd packages/core && yarn lint-staged diff --git a/packages/core/package.json b/packages/core/package.json index 09cb299bec..c36ea15abd 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -15,7 +15,7 @@ "lint": "next lint", "stylelint": "stylelint \"**/*.scss\"", "stylelint:fix": "stylelint \"**/*.scss\" --fix", - "postinstall": "node postinstall.js && (is-ci || husky install) || echo Skipped postinstall step for @faststore/core", + "postinstall": "node postinstall.js && (is-ci || (cd ../.. && husky install packages/core/.husky)) || echo Skipped postinstall step for @faststore/core", "partytown": "partytown copylib ./public/~partytown", "storybook": "start-storybook --docs -p 6006", "build-storybook": "build-storybook"