Tslint: glob patterns don't find all matching files if folder structure is moderately complex

Created on 7 Dec 2016  路  2Comments  路  Source: palantir/tslint

Bug Report

  • __TSLint version__: 4.0.2
  • __TypeScript version__: 2.0.10
  • __Running TSLint via__: CLI

TypeScript code being linted

Actual behavior

depending on which glob I use, not all files are linted, even though the globs should catch all files. With a single folder everything is fine, but when I create a nested folder structure, things begin to break down, and app/*/.ts no longer runs linting against every ts file in the app folder and all subfolders

Expected behavior

Should lint all ts files under the app folder.

To Reproduce

I have created a failing project.
from a fresh directory:

git clone https://github.com/joeeames/tslint-glob-fail.git
cd tslint-glob-fail
npm i typescript tslint
node_modules/.bin/tslint app/**/*.ts

Note that 1 error is found

Now run

node_modules/.bin/tslint app/*.ts

A different set of failures are found

Now run

node_modules/.bin/tslint app/**/*.spec.ts

A different set of failures are found.

All the failures should be found with the first command.

Not A Bug

Most helpful comment

Thanks for the info. Things are good now.

I didn't really find the solution in the links you listed, like no example of
instead of doing: tslint app//.ts
do: tslint "app/
/.ts"

But here when you said "supply globs as strings". So I don't know if anyone else who has the same issue can find the solution easily...I certainly spent a couple hours googling and reading to try to find a documented solution.

All 2 comments

See my comment here: https://github.com/palantir/tslint/issues/1560#issuecomment-264520174

The globs in your examples are expanded by your shell, not the TSLint CLI. Not much we can do here. If you supply globs as strings instead, we use node-glob to expand them.

Thanks for the info. Things are good now.

I didn't really find the solution in the links you listed, like no example of
instead of doing: tslint app//.ts
do: tslint "app/
/.ts"

But here when you said "supply globs as strings". So I don't know if anyone else who has the same issue can find the solution easily...I certainly spent a couple hours googling and reading to try to find a documented solution.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DanielKucal picture DanielKucal  路  3Comments

SwintDC picture SwintDC  路  3Comments

ypresto picture ypresto  路  3Comments

zewa666 picture zewa666  路  3Comments

denkomanceski picture denkomanceski  路  3Comments