Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid source file for a.pass.ts #121

Open
unional opened this issue May 10, 2017 · 5 comments
Open

Invalid source file for a.pass.ts #121

unional opened this issue May 10, 2017 · 5 comments

Comments

@unional
Copy link

unional commented May 10, 2017

gulp-tslint version: 7.1.0
tslint version: 5.2.0
Operating system: OSX

Example gulp configuration (if applicable):
With type-checking

function positiveTest(config) {
  var program = tslint.Linter.createProgram('./tsconfig.json')
  return gulp.src(`spec/${config}/*.pass.ts`)
    .pipe(gulpTslint({
      configuration: `./${config}.js`,
      formatter: 'verbose',
      program
    }))
    .pipe(gulpTslint.report());
}

Error console output:

Error:
Invalid source file: align.pass.ts. Ensure that the files supplied to lint have a .ts, .tsx, .js or .jsx extension.

    at Linter.getSourceFile (/Users/hwong/github/unional/tslint-config-unional/node_modules/tslint/lib/linter.js:207:23)
    at Linter.lint (/Users/hwong/github/unional/tslint-config-unional/node_modules/tslint/lib/linter.js:74:31)
    at /Users/hwong/github/unional/tslint-config-unional/node_modules/gulp-tslint/index.js:102:16
@panuhorsmalahti
Copy link
Owner

panuhorsmalahti commented May 13, 2017

Do you get the same error when running tslint manually using the cli?

@unional
Copy link
Author

unional commented May 13, 2017

Nope.

@panuhorsmalahti
Copy link
Owner

You should update to gulp-tslint 8, then try if the error persists.

@ishitatsuyuki
Copy link

I have reproduced the case. The trick here is that if you tried to lint something that isn't covered by tsconfig.json globs, it result in undefined source, triggering the failure. For my case, it was node_modules, so adjusting the glob deliberately to exclude irrelevant files solved the error.

@sompylasar
Copy link

Refs palantir/tslint#2208

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

No branches or pull requests

4 participants