-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to process files with a $ in their path #651
Comments
Thank you for the issue. I think the problem occurs because for windows the argument includes the quotes, while on Linux/macOS those quotes are treated differently because the actual command is wrapped with |
|
@eikowagenknecht , does wrapping {staged_files} in pre-commit:
parallel: false
commands:
eslint:
glob: "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx}"
run: npx eslint "{staged_files}" |
Indeed, |
I'm closing this issue since there's a workaround found. Thank you, @wonu! |
🔧 Summary
Mostly the same as #303, but instead of
No files matching the pattern "some/path/to..tsx" were found.
I getNo files matching the pattern "'some/path/$file.tsx'" were found.
I'm using Windows.
Lefthook version
1.6.3 0845abb
Steps to reproduce
$
in its name.lefthook.yml:
Expected results
File is processed.
Actual results
Possible Solution
It seems like there are too many quotes arount the staged files. From the console:
npx eslint 'src/routes/manage/$cardId.tsx'
-> worksnpx eslint "src/routes/manage/$cardId.tsx"
ornpx eslint src/routes/manage/$cardId.tsx
->No files matching the pattern "src/routes/manage/.tsx" were found.
Logs / Screenshots
I especially notice the line
[lefthook] executing: npx eslint 'src/routes/manage/$cardId.tsx'
, which is exactly what I run from the console. And there it works?This issue documents the problem for eslint only, but I have the same problem with Biome for example, where a " × The system cannot find the path specified. (os error 3)" error is thrown instead of the message eslint gives. For this as well, running
npx biome check --apply --no-errors-on-unmatched --files-ignore-unknown=true 'src/routes/manage/$cardId.tsx'
from the console works fine.The suggested workaround
does not work for me and only gives the error message
'node_modules' is not recognized as an internal or external command, operable program or batch file.
The text was updated successfully, but these errors were encountered: