-
Notifications
You must be signed in to change notification settings - Fork 352
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
git-hooks.hooks.prettier.settings.binPath
does not allow value ./node_modules/.bin/prettier
#1670
Comments
Try with: package = null;
entry = "./node_modules/.bin/prettier "; This just templates the correct |
Take tip from comment cachix/devenv#1670 (comment)
Took your tip, @thenonameguy (added a Prettier now tries to parse any file – which is not what I would expect without modifying Thank you for your help so far, @thenonameguy. Even though there is still work to be done, this was a step in the right direction 😄
|
You are welcome! Now try adding ‘types_or = [“json” “yaml”];’ to limit for
which filetypes it should run.
[image: photo] <https://schemamap.io/about?ref=email-signature>
Krisztián Szabó
Founder & CEO, Schemamap.io Kft.
[image: icon] +36204591417 [image: icon] schemamap.io [image: icon]
***@***.***
[image: icon] Budapest, Hungary
<https://maps.google.com/?q=Budapest,+Hungary>
[image: linkedin] <https://www.linkedin.com/in/kriszszabo/>
[image: Meeting Button App] <https://schemamap.io/meeting>
…On 2025. Jan 19., Sun at 7:01, Eirik Vågeskar ***@***.***> wrote:
Took your tip, @thenonameguy <https://github.com/thenonameguy> (added a -w
to the prettier command). Result on the entry-overridden-package-null
branch.
Prettier now tries to parse any file – which is not what I would expect
without modifying git-hooks.hooks.prettier.files or .types explicitly.
See output below.
Thank you for your help so far, @thenonameguy
<https://github.com/thenonameguy>. Even though there is still work to be
done, this was a step in the right direction 😄
$ devenv test
• Overriding .devenv to .devenv.XVf8SKCgSupD
• Building tests ...
• Using Cachix: devenv
this derivation will be built:
/nix/store/dslfrpj5pqg29qbp1bcn70pwax9na86g-devenv-test.drv
building '/nix/store/dslfrpj5pqg29qbp1bcn70pwax9na86g-devenv-test.drv'
✔ Building tests in 6.3s.
• Running tests ...
• Building shell ...
building '/nix/store/0cvp65cwq48xw5ssyc8lhs9figyxks8h-devenv-shell-env.drv'
Sourcing pytest-check-hook
Using pytestCheckPhase
✔ Building shell in 2.5s.
Running tasks devenv:enterShell
Succeeded devenv:git-hooks:install 27ms
Succeeded devenv:enterShell 10ms
2 Succeeded 39.03ms
• Setting up shell environment ...
Running tasks devenv:enterShell
Succeeded devenv:git-hooks:install 20ms
Succeeded devenv:enterShell 10ms
2 Succeeded 30.73ms
• Testing ...
Running tasks devenv:enterTest
Failed devenv:git-hooks:run 352ms
Dependency failed devenv:enterTest
1 Failed, 1 Dependency Failed 352.53ms
--- devenv:git-hooks:run failed with error: Task exited with status: exit status: 1
--- devenv:git-hooks:run stdout:
0000.01: prettier.................................................................Failed
0000.01: - hook id: prettier
0000.01: - exit code: 2
0000.01: - files were modified by this hook
0000.01:
0000.01: [error] No parser could be inferred for file "/Users/myuser/prettier-binpath-mwe/.envrc".
0000.01: index.js 18ms
0000.01: [error] No parser could be inferred for file "/Users/myuser/prettier-binpath-mwe/devenv.nix".
0000.01: package-lock.json 2ms (unchanged)
0000.01: [error] No parser could be inferred for file "/Users/myuser/prettier-binpath-mwe/devenv.lock".
0000.01: [error] No parser could be inferred for file "/Users/myuser/prettier-binpath-mwe/.gitignore".
0000.01: devenv.yaml 10ms (unchanged)
0000.01: package.json 14ms (unchanged)
0000.01:
--- devenv:git-hooks:run stderr:
---
✔ Running tests in 4.4s.
✖ Tests failed :(
Error: × Tests failed
—
Reply to this email directly, view it on GitHub
<#1670 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQ5JXOFYJCO5RC2NIWTZJ32LM5TZAVCNFSM6AAAAABVE6BD36VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMBQG4YTSMJQGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Great, you are welcome! Adding 'types_or = ["json" "yaml"];' should solve the remaining problem. |
Describe the bug
Using
git-hooks.hooks.prettier.settings.binPath = ./node_modules/.bin/prettier
(as suggested in https://devenv.sh/reference/options/#git-hookshooksprettiersettingsbinpath) makesdevenv shell
crash with the error messageerror: path '/node_modules' does not exist in Git repository '/Users/myusername/repo'
. Checking innode_modules
makes the shell evaluate, but the pre-commit hook crashes on execution.There may be technical reasons for this behavior, but I have not found an explanation in the documentation. If the error cannot be remedied, I would suggest adding a warning to the documentation for the option.
To reproduce
When
node_modules
is not checked in (the main case).When
node_modules
is checked in:Version
The text was updated successfully, but these errors were encountered: