Replies: 2 comments
-
I think the problem here is Prettier's exit code. I was able to fix this problem with a workaround by using pretty-quick: lefthook.yml pre-commit:
parallel: true
commands:
prettier:
run: yarn pretty-quick --staged --ignore-path .gitignore |
Beta Was this translation helpful? Give feedback.
-
Update: Because pretty-quick doesn't work yet with Prettier 3 (TypeError: prettier.resolveConfig.sync is not a function), I decided to replace it with plain lefthook.yml pre-commit:
parallel: true
commands:
config:
glob: '*.{css,html,json,less,md,scss,yaml,yml}'
run: npx prettier --write --log-level error {staged_files}
code:
glob: '*.{js,jsx,ts,tsx}'
run: npx eslint {staged_files} --fix P.S. I found this by reading this article. |
Beta Was this translation helpful? Give feedback.
-
I have this in my
lefthook.yml
:Then I edit my
.js
file and stage it:After it I am testing lefthook to run pre-commit commands with
lefthook run pre-commit
and I get:What I do wrong and how to fix this behavior?
Beta Was this translation helpful? Give feedback.
All reactions