- Регистрация
- 1 Мар 2015
- Сообщения
- 1,481
- Баллы
- 155
In this article, we review .
But what is lefthook?
LeftHook
is a fast and powerful Git hooks manager for any type of projects.
Install
npm install lefthook --save-dev
Usage
Configure your hooks, install them once and forget about it: rely on the magic underneath.
# Configure your hooks
vim lefthook.yml
# Install them to the git project
lefthook install
# Enjoy your work with git
git add -A && git commit -m '...'
n8n/lefthook.yml
pre-commit:
commands:
biome_check:
glob: 'packages/**/*.{js,ts,json}'
run: pnpm biome check --write --no-errors-on-unmatched --files-ignore-unknown=true --colors=off {staged_files}
stage_fixed: true
skip:
- merge
- rebase
prettier_check:
glob: 'packages/**/*.{vue,yml,md,css,scss}'
run: pnpm prettier --write --ignore-unknown --no-error-on-unmatched-pattern {staged_files}
stage_fixed: true
skip:
- merge
- rebase
This above code is picked from .
pre-commit
In a lefthook.yml file, the pre-commit block defines Git hooks that run before a commit is created.
Before your commit is created, there are two commands run:
This runs the below command
pnpm biome check --write --no-errors-on-unmatched --files-ignore-unknown=true --colors=off {staged_files}
2. prettier_check
This runs the below command
pnpm prettier --write --ignore-unknown --no-error-on-unmatched-pattern {staged_files}
This is a common practice to lint and apply pettier to your code before your code is committed.
About me:
Hey, my name is . I study large open-source projects and create content about their codebase architecture and best practices, sharing it through articles, videos.
Configure features such as Changesets in your Next.js project using .
Email — ramu@thinkthroo.com
My Github —
My website —
My YouTube channel —
Learning platform —
Codebase Architecture —
Best practices —
Production-grade projects —
References
But what is lefthook?
LeftHook
is a fast and powerful Git hooks manager for any type of projects.
Install
npm install lefthook --save-dev
Usage
Configure your hooks, install them once and forget about it: rely on the magic underneath.
# Configure your hooks
vim lefthook.yml
# Install them to the git project
lefthook install
# Enjoy your work with git
git add -A && git commit -m '...'
So obviously there is a lot of information in the . We want to focus only on the options used in .I picked the installation and usage from the .
n8n/lefthook.yml
pre-commit:
commands:
biome_check:
glob: 'packages/**/*.{js,ts,json}'
run: pnpm biome check --write --no-errors-on-unmatched --files-ignore-unknown=true --colors=off {staged_files}
stage_fixed: true
skip:
- merge
- rebase
prettier_check:
glob: 'packages/**/*.{vue,yml,md,css,scss}'
run: pnpm prettier --write --ignore-unknown --no-error-on-unmatched-pattern {staged_files}
stage_fixed: true
skip:
- merge
- rebase
This above code is picked from .
pre-commit
In a lefthook.yml file, the pre-commit block defines Git hooks that run before a commit is created.
Before your commit is created, there are two commands run:
- biome_check
This runs the below command
pnpm biome check --write --no-errors-on-unmatched --files-ignore-unknown=true --colors=off {staged_files}
2. prettier_check
This runs the below command
pnpm prettier --write --ignore-unknown --no-error-on-unmatched-pattern {staged_files}
This is a common practice to lint and apply pettier to your code before your code is committed.
About me:
Hey, my name is . I study large open-source projects and create content about their codebase architecture and best practices, sharing it through articles, videos.
Configure features such as Changesets in your Next.js project using .
Email — ramu@thinkthroo.com
My Github —
My website —
My YouTube channel —
Learning platform —
Codebase Architecture —
Best practices —
Production-grade projects —
References