← 返回首页
GitHub - biomejs/pre-commit: Biome's pre-commit hooks. · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

biomejs/pre-commit

Go to file
Code

Repository files navigation

pre-commit hooks

This repository provides Biome hooks for pre-commit.

The following section assumes that you installed pre-commit and run pre-commit install in your repository.

Using biome's pre-commit hooks

Biome provides four hooks:

hook id description
biome-ci Check formatting, check if imports are organized, and lints
biome-check Format, organize imports, lint, and apply safe fixes to the committed files
biome-format Format the committed files
biome-lint Lint and apply safe fixes to the committed files

For example, if you want to use the biome-check hook, add the following pre-commit configuration to the root of your project in a file named .pre-commit-config.yaml:

repos: - repo: https://github.com/biomejs/pre-commit rev: v2.4.15 # Use the sha / tag you want to point at hooks: - id: biome-check

Using biome with a local pre-commit hook

If Biome is already installed as a npm package in your local repository, then it can be a burden to update both package.json and .pre-commit-config.yaml when you update Biome. Instead of using the provided Biome hooks, you can specify your own local hook.

For example, if you use npm, you can write the following hook in .pre-commit-config.yaml:

repos: - repo: local hooks: - id: local-biome-check name: biome check entry: npx biome check --write --files-ignore-unknown=true --no-errors-on-unmatched language: system types: [text] files: "\\.(jsx?|tsx?|c(js|ts)|m(js|ts)|d\\.(ts|cts|mts)|jsonc?|css|svelte|vue|astro|graphql|gql)$"

The pre-commit option files is optional, because Biome is able to ignore unknown files (using the option --files-ignore-unknown=true).

About

Biome's pre-commit hooks.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

 
 
 

Contributors

Footer

© 2026 GitHub, Inc.