Replies: 1 comment
|
Seems I found a good solution in a different thread. It results in a lot of redundant Lefthook configs, but it's better than nothing! |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
At my company, we have dozens of TypeScript projects that were recently moved into a single monorepo. For historic reasons, we use different Prettier configs per project, or even different formatrters. Using a single config from the root level is currently not an option.
Consider the following pre-commit hook:
The problem is that lefthook is not able to determine the closest Prettier config relative to a staged file – it always uses the root config. Prior to lefthook, we used a combination of husky and lint-staged. The former doesn't work great in monorepos, the latter could deal with the problem I described. As far as I can tell, they determine the closest lint-staged config and use it's directory as CWD when executing a hook command.
I'm certain we're not the first with this problem. Did anybody manage to fix this issue? Are there plans to tackle this in future versions of Lefthook?
All reactions