-
Notifications
You must be signed in to change notification settings - Fork 33
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
fix(exit-code): determination logic #199
Conversation
Current coverage is 100% (diff: 100%)@@ master #199 diff @@
====================================
Files 9 9
Lines 228 231 +3
Methods 0 0
Messages 0 0
Branches 0 0
====================================
+ Hits 228 231 +3
Misses 0 0
Partials 0 0
|
@ta2edchimp @ljharb please review when you get time. This should get merged ASAP. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this already have a test covering it? If so, great, if not, can this PR add one?
// if --no-error is passed argv.error will be false | ||
// if -n was passed it would set argv.error to false | ||
if (argv.n) { | ||
argv.error = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you may prefer not to mutate argv
here - ie, const showError = argv.error && !argv.n;
and then const processExitCode = argv.u && showError ? 1 : 0;
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I originally did it in that way, but though for this scope it was not required. But good practice is always good practice. Will update it accordingly.
I named the variable as errorOut
.
argv.error is true by default if --no-error is passed argv.error will be false if -n was passed it would set argv.error to false
e532a6b
to
a279253
Compare
Please find the test at https://github.com/sarbbottam/eslint-find-rules/blob/master/test/bin/find.js#L100-L112. |
existing logic to determine exit code was not correct.
argv.error is true by default
if --no-error is passed argv.error will be false
if -n was passed it would set argv.error to false
fixes #194
@ljharb @ta2edchimp
Please excuse me for the plethora of PRs over the weekend. Sorry about it.
Hopefully, this is the last one.