pzavolinsky / ts-unused-exports

ts-unused-exports finds unused exported symbols in your Typescript project
MIT License
749 stars 49 forks source link

incorrect use of process.exit #35

Closed samwalshnz closed 5 years ago

samwalshnz commented 5 years ago

In the docs it says:

The output should be:

1 module with unused exports math: add1

Also note the exit status (which equals the number of offending modules)

I'm not sure this is a good idea and wonder if it's really necessary to 'return' the number of files.

Can we remove the following line? https://github.com/pzavolinsky/ts-unused-exports/blob/master/src/cli.ts#L43

Otherwise, if I use the script with npm run scripts (a script in package.json), I get this error:

npm ERR! code ELIFECYCLE
npm ERR! errno 6
npm ERR! consumer-app@0.1.0 npm run lint:unused-exports: `ts-unused-exports ./tsconfig.json`
npm ERR! Exit status 6

'6' is the number of files returned by process.exit

mrseanryan commented 5 years ago

This is merged to master.

We also added an option --exitWithCount in case some people liked the old behavior.