-
Notifications
You must be signed in to change notification settings - Fork 13
Handle non-existent files and custom file extensions #53
Handle non-existent files and custom file extensions #53
Conversation
Also addresses concerns mentioned in eslint/typescript-eslint-parser#568 |
@uniqueiniquity i tested it and seems to work, but can you add test scenario when you do not read file at all, but provide it as code with not existing filename? |
@armano2 thanks for taking a look. I intended |
.... i'm gettin blind i didn't see this test xd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @uniqueiniquity!
🎉 This PR is included in version 7.0.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This PR addresses two main issues brought up in #50 when using the
--project
flag.While these two issues have the same general root cause (i.e. we build programs from the provided tsconfig(s) and then expect the file being parsed to be part of one of them), we address them separately.
For the former issue, we allow for a non-existent file to be used by parsing the compiler options out of a single tsconfig and building a program with that single, non-existent file and those compiler options. My intent was that this should be primarily used for test cases, which may provide code to be parsed instead of the contents of an actual file.
For the latter, we allow for a new string array option
extraFileExtensions
. This is then passed to the TypeScript API so that it will additionally include files with the provided file extensions when resolving the root files of a given program from a tsconfig. Unfortunately, this implementation uses an undocumented extension point in the TS API, so I will be making a change to TypeScript so this behavior is officially supported moving forward.