Description
Version
3.1.1
Reproduction link
https://github.com/millimoose/vue-tslint-microsoft-contrib-bug
Node and OS info
Node 9.7.1 / npm 6.4.1
Steps to reproduce
- Clone and
npm install
in that repro npm run lint --no-fix
What is expected?
Typed TSLint rules should only be run on files that have a corresponding entry in the backing TypeScript program. Some operations run on nodes in the files by TSLint rules query the program for type information only available on those files.
What is actually happening?
The Vue CLI is patching the program's getSourceFile
to return a manually created file from ts.createSourceFile
for Vue files (per isVueFile
).
Untyped rules will work fine with this, but some typed rules will throw. For example, no-unsafe-any
crashes: palantir/tslint#4273
Related TypeScript issue: microsoft/TypeScript#8136
This is a more general case of #2712 as originally reported by @millimoose. The bug investigation trail went from there to TSLint to TypeScript and back to here, amusingly.