-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Why "lint-staged" log is different when is triggered by husky (v6)? #968
Comments
I am experiencing this as well with lint staged 11.0.0 and husky v6. In addition, when I run
|
Having the same issue, @luquera did you manage to solve it? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Unfortunately not yet :( |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Issue is still not solved |
it still not solved till now |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Not sure, but I guess it detects that the terminal aren't capable of rendering the first version and renders the second one. I imagine it's done via an env variable. I would try passing some env variable to try if it's possible to "force" the first type of rendering. And sometimes, it's better to avoid animation and have per-line information (for example logs in Git GUIs). I would check the dependencies that lint-staged uses for rendering the results. That said, as far as I know, I don't think there's anything that can be done in husky's code to help with that. |
same here |
Has anyone found resolve? |
It worked for me before, but since yesterday I've now bumped into the same exact issue. |
Okay it seems like this is working for me: |
Partially fixed in |
The issue seems to be that I'm not sure what caused this to start happen, but I assume it is an update to one of:
|
For a simple reproduction, try running in your terminal:
Putting this same script into the #!/usr/bin/env sh
. "$(dirname "$0")/_/husky.sh"
node -e "console.log(require('tty').isatty(1))" |
Hi, I have a similar issue but in my case the terminal is being exploded with repeated log output.
running yarn lint-staged Through git hooks (added with husky):PowerShell.2022-09-06.16-37-59.mp4Directly running the command:PowerShell.2022-09-06.16-39-07.mp4 |
If I make a commit from vscode UI, by keeping .husky/pre-commit: line 4: /dev/tty: Device not configured |
Exactly the same thing happens to me and my team. Can't understand why and there seems to be no working solution from what I can find. I think this is a seroius issue that will affect usage. But Like I said I cant figure out why this accure. Edit: |
@Nick-Hopps No, I checked it. |
i have the same problem but after i change /dev/tty to /dev/console it works i dont know how it works exactly but anyway it works. (ㅠ.ㅠ) |
maybe you should run your command in terminal not in VSCODE or webStrom . @wherehows |
Same problem here |
@wherehows It works when I'm using terminal panel, but doesn't work when using the SOURCE CONTROL gui panel (commit by press 'Commit' button), do you have same problem, and do you solve it if so? VSCode said |
not only source control but also 'fork' tool doesnt work. i haven't solved it yet ㅠ.ㅠ |
I managed to solve the issue by downgrading "lint-staged" from 13.x to 12.x |
@siarheiyelin Are you sure downgrading lint-staged fixes it? If so, I can take a look at the updates/changes in version 13 and try out if a culprit can be found. |
Can you try installing |
@iiroj This fixes the repeated logs issue (as seen in #968 (comment)), but shows instead the uncolored output as described in the original post. I guess this is better than the repeated outputs, but we're basically back to where we started. |
this comment fixed the original issue for me. i reverted my pre-commit file |
Documented a combination of fixes in https://gist.github.com/webbertakken/c2b457d39224baf701c8de1589b61555. Works for:
Tested with WebStorm IDE and latest git versions. @Geczy @akmaldira @MrFlyHouse @loriswit this should solve your problems as well. |
Git hooks output running using husky gives output as a plain text without animated log when npx lint-staged is used. A temporary fix of redirecting stdout and stderr taken from typicode/husky#968 (comment) works for the current version of husky and lint-staged.
This reverts commit 145923d. The workaround was taken from typicode/husky#968 (comment) which corrected the husky log output with lint-staged but lead to error "/dev/tty: No such device or address" while using semantic-release.
@webbertakken Thank you! Your script is exactly what I was looking for! I've tried settings manually |
Unfortunately it does not work with Windows Terminal WSL under a docker container. For example using Laravel Sail. |
@typicode It's not fixed in v9? I'm facing the same issue... |
Everything is set up correctly, according to the documentation. I'm using Windows 10.
by husky:
by npm script (running lint-staged):
Thanks!
The text was updated successfully, but these errors were encountered: