Skip to content

Commit fc24106

Browse files
committed
Tooling: Add biome to pre-commit check
Enable VCS in biome so it doesn't lint things like .venv and other cache directories. Add local biome binary check to Makefile. If you have biome installed locally, it will use that instead and save the npx setup time.
1 parent 1e9df13 commit fc24106

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,9 @@ repos:
55
name: Lint commit message to ensure it will pass the commit linting on CI
66
entry: scripts/lint-commit.sh
77
stages: [ commit-msg ]
8+
language: system
9+
- id: run-biome
10+
name: Check for linting and formatting for source code using Biome
11+
entry: scripts/run-biome.sh
12+
stages: [ pre-commit ]
813
language: system

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
BIOME_BASE_CMD := npx @biomejs/biome
1+
BIOME_BASE_CMD := $(if $(shell which biome),biome,npx @biomejs/biome)
22
BIOME_CONFIG_PATH := --config-path="biome.json"
33
WRITE_FLAG := --write
44

biome.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
33
"vcs": {
4-
"enabled": false,
4+
"enabled": true,
55
"clientKind": "git",
6-
"useIgnoreFile": false
6+
"useIgnoreFile": true
77
},
88
"files": {
99
"ignoreUnknown": false,

scripts/run-biome.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
make biome-all

0 commit comments

Comments
 (0)