rizowski / eslint-watch

ESLint with simple watching capabilities
https://www.npmjs.com/package/eslint-watch
MIT License
196 stars 29 forks source link

Oddly tracking exit code #125

Closed brokentone closed 5 years ago

brokentone commented 7 years ago

Environment

Basic Description of the problem

One of the features of this tool seems to be recording the last exit code from a full run and replaying that on the process exit: (https://github.com/rizowski/eslint-watch/blob/master/src/index.js#L25)

However, this is current inconsistent and I would argue even undesired behavior.

Undesired: The main process this tool is running is a watch of files. If it is successfully able to watch the files and report on them on changes, the process should succeed (exit with a 0 status). Since it is going reporting over longer periods of time, playing back an earlier child exit code is decoupled from the actual errant behavior, which is confusing.

Inconsistent: Right now, if you have no errors initially, but have the --watch --changed flags on, introduce an error in a file, you will see the error reported, then kill the process, you will exit with a code of 0, vs if you now restart and have the error initially, you will exit with a code of 1.

Recommend error status from eslint is not passed through to main exit code.

How to reproduce it

  1. Command: esw --watch --changed
  2. Have no errors in your code
  3. Exit after initial pass
  4. Exit code 0
  5. Restart process
  6. Wait for initial pass
  7. Introduce error
  8. Exit
  9. Still exit code 0 (should be 1 if this is a consistent feature).

Debug output:

// to grab debug output set DEBUG=esw:*
rizowski commented 7 years ago

I am fine with changing this feature.

At the time it made sense to relay the last exit code of a previous run. In terms of the exit code representing whether or not the watch command failed is also an acceptable alternative.

rizowski commented 5 years ago

@brokentone I believe this is fixed with the latest V5. I made a big overhaul on the way error codes are passed around as well as changed everything to async/await to help with some of the other issues you had reported previously.

rizowski commented 5 years ago

Closing for now, but if this is still an issue I am willing to reopen it to discuss.