-
Notifications
You must be signed in to change notification settings - Fork 3
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
Lint-staged integration doesn't stop on failure #353
Comments
Well it looks like returning -1 and outputting to the console output is definitely not enough to get lint-staged to exit prematurely so time to look into errors. |
Yep, looks like we need to throw an exception annoyingly.... |
This will require a major build update. Luckily, we're aiming for 3.0.0 soon so we'll lump this in there :-) |
Investigating what other tools do so we can be consistent. SetupI created a file called
TslintResults in no errors along with a return code of 0
PrettierPrettier did throw an error and also returned a return code of 2. This also seems to make lint-stage fail.
|
Investigating a bit more, we have two types of errors it seems... Unsupported filesThere are ones where files aren't supported... These make no sense to fire an error on because there's nothing the consumer can do
Sortier failed because of an internal errorThese are internal errors that sortier can't handle but the source code maybe valid
Sortier failed because file couldn't be compiledThese are scenarios where the file couldn't be sorted because the source is invalid.
ConclusionI think the expected behavior should be:
That latter one should really be caught by people's builds to be honest but we shouldn't fail silently |
Unsupported files should log in diagnostic mode - #579 |
Released with 3.0.0 |
Language
All
Sample input source code
A file of which fails to be parsed due to invalid javascript
Expected output
When running
git commit -a -m "asdfasdf"
that the file which failed to be parsed to stop lint-staged from continuingActual output (or error message)
lint-stage just continues and commits the unsorted file
The text was updated successfully, but these errors were encountered: