Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Exit code always 1 with type check errors and --force active #2087

Closed
lepus2589 opened this issue Jan 20, 2017 · 3 comments · Fixed by #2322 or singapore/lint-condo#263
Closed

Exit code always 1 with type check errors and --force active #2087

lepus2589 opened this issue Jan 20, 2017 · 3 comments · Fixed by #2322 or singapore/lint-condo#263

Comments

@lepus2589
Copy link
Contributor

Bug Report

  • TSLint version: 4.3.1
  • TypeScript version: 2.1.5
  • Running TSLint via: CLI

TypeScript code being linted

(x: Number): void => {
    // x is not used in here
}

with tslint.json configuration: irrelevant

Actual behavior

Type checking is activated via the --type-check option as well as the --force switch. noUnusedParameters is active in the tsconfig.json, which is given to TSLint with the --project argument. The Typescript compiler will of course flag the parameter of the above function as unused.
The file runner.js prints the error message ('x' is declared but never used.) using an Error. It is not caught anywhere, so the exit code is 1 despite --force being used and the (valid) error message is followed by a stack trace.
Is this the intended behaviour?

Expected behavior

I would expect TSLint to print the error messages emitted by the Typescript compiler as linting errors, without an ugly stack trace containing TSLint source files. If not that, then at least when using the --force flag, the exit code should be 0, as stated in the documentation.

@psulek
Copy link

psulek commented Feb 23, 2017

@lepus2589 Experiencing same problem with tslint version 4.4.2 and typescript 2.2.1.

@ajafff ajafff mentioned this issue Mar 9, 2017
4 tasks
nchen63 pushed a commit that referenced this issue Mar 10, 2017
[bugfix] exit with 0 on type check errors when `--force` is specified
Fixes: #2087
[bugfix] `--test` now correctly strips single quotes from patterns on windows
[enhancement] `--test` can handle multiple paths at once
[enhancement] added `-p` as shorthand for `--project` to be consistent with `tsc`
Kind of fixes: #2291
[enhancement] print error when `--type-check` is used without `--project`
[enhancement]  don't print stack trace on type check error
@adidahiya adidahiya added this to the TSLint 5.0 milestone Mar 10, 2017
@calidion
Copy link

any progress on this?
tslint with errors but still returns 1

@adidahiya
Copy link
Contributor

@calidion the issue is marked as closed & fixed. if you're still seeing it you should probably open a new bug report. note that the --type-check option is deprecated.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants