-
-
Notifications
You must be signed in to change notification settings - Fork 412
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
Duplicated errors #142
Comments
I've also tried |
It looks like you're running lint-staged with verbose renderer but I'm not sure why this is happening. Are you using GUI and not CLI? |
@okonet I'm using a latest version of Git Tower for Mac https://www.git-tower.com/. |
I see. I don't use git GUIs so this isn't a priority for me but you can write a custom renderer based on https://github.com/SamVerschueren/listr-verbose-renderer that would suppress the intermediate errors and only show them in the end and submit a PR. |
@okonet as many other people do, I use GUI to visualize changes. I hope we don't need a different renderer for this issue, we just need to support a silent logLevel https://docs.npmjs.com/misc/config#loglevel So it won't output the errors but will keep them for Husky, which would print them inside GUI. |
npm scripts are running in the silent mode by default when used with lint-staged: https://github.com/okonet/lint-staged/blob/master/src/findBin.js#L17 Again, feel free to explore what works best for you and submit a PR. |
I'm using CLI and have the same issue with stylelint. |
@julec please show me your config |
|
@okonet
Could the problem be in listr package? |
Yeah, it seems like Listr displaying errors multiple time. We could try a custom renderer to fix this. |
@okonet Could you help me with that? I'm not sure I understand what to do. |
@SamVerschueren do you think this can be switched off somehow? Or do we need to write a custom renderer for that? |
Just to understand what is happening.
This is already fixed in |
@SamVerschueren thanks for chiming in. Yes, exactly. Additionally, since I'm displaying all errors from all linters after they all are done running once again, I'm not even sure I want to show any of them during the run. Is that possible? |
Currently not. Though this might indeed be nice. What do you think about adding an option to listr-update-renderer like |
Let me check later today and I'll see what I can come up with. |
The duplicate error thingy should be fixed now in |
Did I say already how awesome you are? 🥇 |
Don't need to, but thanks :) 🍻 |
Guys, I've updated lint-staged but nothing have changed in CLI results.
|
Well, I think there is 1 less. We'll still need to do something about the duplication, it seems. 🤔 |
It's because the Listr output is separate from the lint-staged output. So Listr just works as intended. I'm open to suggestions. Something like |
If you think such option would be beneficial for Listr, I'd prefer it. Otherwise I could try making a custom renderer but it seems it will be a lot code duplication. Your call. |
I think an option could make sense. I'll have a look at it in a couple of days. Quite busy lately. I'll keep you posted. |
Has a resolution to this been found? Just wondering bc it has some of the less-experienced/new devs confused when they see the error output and depending on how many errors it can get really difficult to read. |
Does anyone wants to stab this one? I'd be happy about a PR |
I took a look at this problem yesterday as a team I work with has been a little frustrated by this, too. Some of our script output can really blow up your screen when printed a few times. I came across an option in Listr, I see this issue when I use Git Bash but not on a standard Windows terminal and as OP @fronteed also noted he was running lint-staged in a Git Tower application, I think this might be the problem - nonTTY environments just use a verbose renderer. I'm not sure this is the root cause and so want to run this by @okonet before submitting a PR. Thinking we can either just set the Listr nonTTYRenderer option to 'silent' or set it based on a flag. |
@JonKrone If it solves it please go for it. Lint-staged can't be used on CI, so we won't have any problem with overriding it I think. The only place where we use verbose renderer is tests but we must set it explicitly I think. |
Great, I'll work on a PR with tests and all that this weekend. I want to know more about the TTY distinction and why it thinks my output channel isn't a TTY. |
Instead of throwing the error to the error method, we log it and pass an empty string to it.
Fix duplicate error messages lint-staged#142
@okonet thank you for the package.
I got duplicates in output while trying to use link-staged with husky, here's my config:
Output:
Looks like lint-staged and husky both output the same error.
Here I got 2 errors from lint-staged and one from husky.
Can we add some --silent option for lint-staged? So it would not output the errors, but throw them forward to husky (I also use husky for another lintings).
The text was updated successfully, but these errors were encountered: