From 6b84c8963d8a4d621adbb9bf625060095c8f4356 Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Fri, 24 Apr 2026 12:00:26 +0700 Subject: [PATCH] Scope pre-commit lint and format to staged files --- lefthook.yml | 14 ++++++++------ package.json | 1 + 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lefthook.yml b/lefthook.yml index ca5e0e337..b746ba2fd 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -1,9 +1,11 @@ pre-commit: parallel: true - commands: - format: - run: npm run format:check - lint: - run: npm run lint - typecheck: + jobs: + - name: format + glob: "*.{css,js,json,jsonc,jsx,md,ts,tsx,yaml,yml}" + run: npm run format:check:files -- {staged_files} + - name: lint + glob: "*.{js,jsx,ts,tsx}" + run: npm run lint -- {staged_files} + - name: typecheck run: npm run typecheck diff --git a/package.json b/package.json index 0555c2bc1..39c76e100 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ "format": "oxfmt .", "format:files": "oxfmt", "format:check": "oxfmt --check .", + "format:check:files": "oxfmt --check", "lint": "oxlint", "lint:fix": "oxlint --fix", "knip": "knip",