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

When project hasn't any ts-file, throw error #1863

Closed
arvitaly opened this issue Dec 13, 2016 · 5 comments
Closed

When project hasn't any ts-file, throw error #1863

arvitaly opened this issue Dec 13, 2016 · 5 comments

Comments

@arvitaly
Copy link

arvitaly commented Dec 13, 2016

Bug Report

My project has one d.t.s file and tslint throw error.

  • TSLint version: 4.0.2
  • TypeScript version: 2.1.4
  • Running TSLint via: CLI

TypeScript code being linted

with tslint.json configuration:

{
    "extends": [
        "tslint:latest"
    ]
}

Actual behavior

TypeError: Reduce of empty array with no initial value in \node_modules\tslint\lib\tslint-cli.js:224:6

Expected behavior

No error.

@arvitaly arvitaly changed the title When project not has any ts-file, throw error When project hasn't any ts-file, throw error Dec 13, 2016
@IllusionMH
Copy link
Contributor

IllusionMH commented Dec 24, 2016

@arvitaly I think there is easy fix, but unfortunately I can't reproduce your case.
Can you provide your file structure and exact command on how you call tslint? Do you use --project flag?

IllusionMH added a commit to IllusionMH/tslint that referenced this issue Dec 25, 2016
@arvitaly
Copy link
Author

@IllusionMH Hi!
tslint-error

@IllusionMH
Copy link
Contributor

@arvitaly thanks. This screenshots confirms my thoughts.
Looks like I reproduced case similar to yours and error will be fixed after merge of #1933.

TSLint is supposed to lint .ts, .tsx.js and .jsx files.
.d.ts are skipped (see linter.ts:88)

To make TSLint properly check files your tsconfig.json should have files or include section or/and you can pass globs for .ts files (along with --project flag) in command line.

@arvitaly
Copy link
Author

@IllusionMH, thanks!

@arvitaly
Copy link
Author

arvitaly commented Dec 25, 2016

I faced with this situation, when i developed types for https://github.com/DefinitelyTyped/DefinitelyTyped.
These projects haven't ts-file usually, only d.ts.

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

No branches or pull requests

3 participants