Invite-Only Early Access — Think Throo GitHub App is currently invite-only. Request access here.
2025May

lefthook.yml in n8n codebase.

In this article, we review lefthook.yml in n8n codebase.

But what is lefthook? 

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 '...'

I picked the installation and usage from the lefthook documentation.

So obviously there is a lot of information in the documentation. We want to focus only on the options used in n8n lefthook.yml file.

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 n8n/lefthook.yml.

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:

  1. 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 Ramu Narasinga. Email: ramu.narasinga@gmail.com

Tired of AI-generated code that works but nobody understands?

I spent 3+ years studying OSS codebases and wrote 350+ articles on what makes them production-grade. I built an open source tool that reviews your PR against your existing codebase patterns.

Your codebase. Your patterns. Enforced.

Get started for free —thinkthroo.com

References

  1. https://github.com/evilmartians/lefthook

  2. https://github.com/n8n-io/n8n/blob/master/lefthook.yml