question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Separate exit code for error

See original GitHub issue

Tell us about your environment

  • ESLint Version: Any
  • Node Version: 6
  • npm Version: None, I use Yarn latest.

What parser (default, Babel-ESLint, etc.) are you using? default

Please show your full configuration:

Not relevant.

What did you do? Please include the actual source code causing the issue.

Running an eslint instance which should crash (config error, intern failing like a permission issue…)

What did you expect to happen?

Having a different exist code issue.

What actually happened? Please include the actual, raw output from ESLint.

The exit code issue is the same as a well running eslint with rule violation detection.

Currently, eslint give the same exit code when some lint rules are not respected and when the binary is failing (example: When the provided configuration file does not exists).

On a automated script, we can’t see the difference.

It would be great to have different exit codes:

  • 1 For not respected lint rules.
  • 2 When eslint is failing

Thanks.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:8
  • Comments:21 (15 by maintainers)

github_iconTop GitHub Comments

2reactions
ilyavolodincommented, Dec 29, 2017

I would be against doing that. Introducing an option now just to remove it in a few month doesn’t seem like a good idea. I understand @Soullivaneuh desire to have a working solution now, but it feels like it’s a lot more work for us to do that (introduce a new option, retire a new option, move the code around, etc.).

2reactions
nzakascommented, Oct 25, 2017

Traditionally, we have decided against multiple exit codes because there hasn’t been a lot of evidence that multiple exit codes provide enough value to risk breaking existing integrations that might have logic looking only for exit code 1 (like if (exitCode != 1)). My opinion has generally been the same as Ilya’s in that if something the lint fails for any reason, then you need to look at it, so it only matters that the exit code isn’t zero.

As a reminder, we had an ill-fated experiment where we (actually me) changed the exit code to be the number of lint errors. We had to roll that back because it broke a lot of things, especially when the number of problems was > 254. That’s part of why we’ve been so reluctant to change exit codes since then.

That said, I can see an argument for making this change as the output for limiting problems vs. a crash is different, and I can see it being helpful for tools to be able to know how to bubble up the error details.

So I’m 👍 for keeping exit code 1 for linting errors and introducing exit code 2 for any other type of errors. That would be a breaking change and would have to go in on a major release. I wouldn’t want separate exit codes for every type of error condition as I think that’s overkill.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bash command line exit codes demystified | Enable Sysadmin
An exit code is a system response that reports success, an error, or another condition that provides a clue about what caused an...
Read more >
Appendix E. Exit Codes With Special Meanings
Appendix E. Exit Codes With Special Meanings ; 128, Invalid argument to exit, exit 3.14159, exit takes only integer args in the range...
Read more >
Linux and Unix exit code tutorial with examples - George Ornbo
Tutorial on using exit codes from Linux or UNIX commands. Examples of how to get the exit code of a command, how to...
Read more >
Standard Exit Status Codes in Linux - Baeldung
In shell scripts, we use the exit command to generate exit codes. By using different exit codes for different errors, we can give...
Read more >
Returning different exit code than what command returns in ...
I have a bash script that run some tool that on some use cases returns an error code of 137. I ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found