Tslint: exclude cli option (-e) not working as expected on Linux

Created on 14 Feb 2017  路  2Comments  路  Source: palantir/tslint

Bug Report

  • __TSLint version__: 4.4.2
  • __TypeScript version__: 2.1.6
  • __Running TSLint via__: CLI via npm script

TypeScript code being linted

package.json configuration:

"lint": "./node_modules/.bin/tslint src/**/*.ts test/**/*.ts -e **/*.d.ts"

tslint.json configuration:

"max-line-length": [true, 100],

Actual behavior

On a Linux environment (https://travis-ci.org/a8m/ng-pipes/builds/201461345#L775) the following error occurs:

src/boolean/index.ngfactory.d.ts[3, 1]: Exceeds maximum line length of 100

Locally on my windows 10 the tslint script does not produce any errors.

Expected behavior

The before mentioned error should not occur because the -e **/*.d.ts part of the script excludes files with extension .d.ts.

Things I've checked

  • On both environments index.ngfactory.d.ts exists and on both environments line 3 has a length longer than 100.
  • The TypeScript and TSLint version are the same on both environments

Most helpful comment

That might be because your shell expands the glob pattern and doesn't recognise the globstar (**).

If you wrap all patterns in single quotes they will be passed to tslint as is and tslint will do the glob expansion for you (including globstar).

So for your example, try this:

"lint": "./node_modules/.bin/tslint 'src/**/*.ts' 'test/**/*.ts' -e '**/*.d.ts'"

or even simpler:

"lint": "tslint '{src,test}/**/*.ts' -e '**/*.d.ts'"

All 2 comments

That might be because your shell expands the glob pattern and doesn't recognise the globstar (**).

If you wrap all patterns in single quotes they will be passed to tslint as is and tslint will do the glob expansion for you (including globstar).

So for your example, try this:

"lint": "./node_modules/.bin/tslint 'src/**/*.ts' 'test/**/*.ts' -e '**/*.d.ts'"

or even simpler:

"lint": "tslint '{src,test}/**/*.ts' -e '**/*.d.ts'"

That is exactly what went wrong, many thanks

Was this page helpful?
0 / 5 - 0 ratings