You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The pre-commit types hook never runs for a commit of only .tsx or .jsx files: its glob "*.{js,ts, jsx, tsx}" has spaces #554
I checked for possible duplicate issues, with possible answers.
Bug summary
lefthook.yml's pre-commit types command globs "*.{js,ts, jsx, tsx}". The spaces make two of the brace alternatives jsx and tsx, which no file name matches, so a commit that stages only .tsx or .jsx files skips yarn tsc, and a type error in it is committed. The lint command above it globs "*.{js,ts,jsx,tsx}" and runs.
Windows 11 10.0.26300, Node 26.12.1, Yarn 4.9.2, lefthook 2.1.9 (the repository's dev dependency), Git for Windows.No app or native build is involved: this is the repository's own pre-commit hook.
Steps to reproduce
Clone main and install, which installs the lefthook hooks:
git clone https://github.com/nativewind/react-native-css
cd react-native-css
yarn install
Add a .tsx file with a type error and commit it alone:
printf'export const count: number = "one";\n'> src/type-error.tsx
git add src/type-error.tsx
git commit -m "test: a .tsx file with a type error, committed alone"
Add any .ts file beside it and commit again:
printf'export const control = 1;\n'> src/control.ts
git add src/control.ts
git commit -m "test: a .ts file beside it"
The reproducer branch is main at a37903f with step 2's commit on it, which went in with types skipped.
Expected:types runs in step 2, as it does in step 3, and refuses the commit with the type error.
Actual: step 2 prints types (skip) no matching staged files and commits; step 3 runs types, which reports src/type-error.tsx(1,14): error TS2322 and refuses the commit.
Activity