Skip to content

fix: precommit hooks. Use pnpm filtering instead of lint-staged#65

Merged
edgarkhanzadian merged 1 commit intodevfrom
fix/precommit-hooks
Feb 23, 2024
Merged

fix: precommit hooks. Use pnpm filtering instead of lint-staged#65
edgarkhanzadian merged 1 commit intodevfrom
fix/precommit-hooks

Conversation

@edgarkhanzadian
Copy link
Collaborator

@edgarkhanzadian edgarkhanzadian commented Feb 23, 2024

Closes #62
Some issues i had with lint-staged:

So i'm taking another approach here, run lint, format, typecheck recursively and in parallel only in those packages that have changes compared to the last commit (and on packages that are dependent on packages with changes)

Comment on lines +4 to +7
LATEST_HASH=$(git rev-parse --verify HEAD)

# Run commands only in packages with changed files compared to previous commit and on their dependants in parallel
pnpm -r --filter="...[$LATEST_HASH]" --parallel "/^format$|^lint$|^typecheck$/"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this is faster?

I'm a little skeptical of pre-commit jobs. I've tried using them in the past and it gets annoying having a delay post-commit and I end up --no-verifying relying on CI anyway

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a big fan of it too but it's nice to keep the option for now. We can remove it down the road if it turns out too big a of a pain.

running with parallel recursive pnpm is faster right now, might become a bit slower than lint-staged down the road. But on the plus side, we can run tsc, which imho usually gives more info than eslint.

@edgarkhanzadian edgarkhanzadian added this pull request to the merge queue Feb 23, 2024
Merged via the queue into dev with commit 23df54a Feb 23, 2024
@kyranjamie kyranjamie deleted the fix/precommit-hooks branch February 23, 2024 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix precommit hooks

2 participants