Hello, thank you for the project!
I want to prevent eslint warnings in my commits, but seems like lint-staged checks only eslint errors.
Is it technically possible to check warnings as well?
Wow! Thank you very much!
Is there a way to have lint-staged print the warnings, but not fail?
Some of our lint-staged commands have valuable output, like eslint warnings, or test coverage reports. However, unless a command fails, lint-staged hides all the output.
It'd be nice to show this information to the committer, without preventing them from commiting the code anyway.
This isn't possible with the default renderer. So you might want to use another Listr renderer for that.
how can you use a different Listr renderer?
It’s renderer option. We’re missing it in the readme so if you could send a PR with tho fix it would be great!
It’s
rendereroption. We’re missing it in the readme so if you could send a PR with tho fix it would be great!
@okonet - I've tried the following config in my package.json, and seem to not get warnings printed out for ESLint:
"lint-staged": {
"linters": {
"*.js": [
"eslint --fix",
"git add"
]
},
"renderer": "verbose"
}
Is there another renderer, besides verbose, that I should use to achieve this?
I don’t know what you’re trying to achieve tbh. We use verbose renderer for tests. Check out the code of snapshots.
Same as @simon360
Some of our lint-staged commands have valuable output, like eslint warnings, or test coverage reports. However, unless a command fails, lint-staged hides all the output.
When lint-staged runs and warnings are printed by ESLint, they don't appear to be rendered, but if errors and warnings are both caught, they're printed.

Here you can see if I introduce a purposeful error, I see the Error and a warning in the same file (todo comments are warnings), but if I remove the error, the warning never shows up in the response.
I _believe_ (although not sure) verbose renderer should print warnings from stdout. If it's not when there is no way to do so yet and it needs to be implemented. Can you confirm the output is suppressed even with verbose renderer and let's create a separate issue. Please work on the implementation since I don't have time nor enough motivation to do so.
FWIW, I see the same issue--even with verbose renderer (--debug option), warnings are not displayed.
So I've been doing a bit of debugging (limited by my lack of knowledge of the library) by passing my own Renderer class. In its render() function, I put a console.log() to see what args were passed to the constructor. When I ran lint-staged, I saw the args printed out, but when I ran lint-staged > out.txt, the resulting file didn't contain the args at all, just some lint-staged output:
Stashing changes... [started]
Stashing changes... [skipped]
→ No partially staged files found...
Running linters... [started]
Running tasks for *.js [started]
eslint --fix [started]
eslint --fix [completed]
git add [started]
git add [completed]
Running tasks for *.js [completed]
Running linters... [completed]
My shaky familiarity with filesystem operations may be showing, but I wonder if there's some disconnect between the stdout of the parent lint-staged process and the stdout of the renderer process?
Most helpful comment
Is there a way to have
lint-stagedprint the warnings, but not fail?Some of our
lint-stagedcommands have valuable output, likeeslintwarnings, or test coverage reports. However, unless a command fails,lint-stagedhides all the output.It'd be nice to show this information to the committer, without preventing them from commiting the code anyway.