charlierudolph / dependency-lint

Lints NPM dependencies and devDependencies
MIT License
14 stars 5 forks source link

Make --auto-correct only return an error code if uncorrected errors remain #36

Closed nfriedly closed 7 years ago

nfriedly commented 8 years ago

I can see an argument for the current behavior, but I think that dependency-lint --auto-correct should work similar to eslint . --fix in that fixed errors do not count against the total errors, and if all errors were successfully fixed, then it should return 0 (no error).

Rather then ending with "✖ 1 error", it could say

✓ 1 correction ✓ 0 errors

For the moment, I'm currently putting dependency-lint --auto-correct || dependency-lint in my npm script.

BTW, this is a great tool either way, and I'm definitely going to be using it in more projects.

charlierudolph commented 8 years ago

I don't understand why the exit code for --auto-correct would matter. I think that option should only be used when running manually versus as part of a chain where the exit code matters (like on CI).

nfriedly commented 8 years ago

Well, I am running it in a chain, in my case I had this in my npm scripts:

"autofix": "eslint . --fix; dependency-lint --auto-correct",

The exit code doesn't block it, but it does cause npm to spew out lots of debugging junk.

Also, I just think it should report the current state, not what the state was before the tool ran. It's not a big deal, though. If you prefer it the current way, then just close this ticket.

charlierudolph commented 8 years ago

Auhh. Yeah the npm part is a bit annoying but thats more an npm problem than anything else. Also I don't think it makes sense to have those two in a chain as you won't always need to fix both.

nfriedly commented 8 years ago

Fair enough.