-
-
Notifications
You must be signed in to change notification settings - Fork 204
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
Support "Type aware" linting for gts files #1995
Comments
@NullVoxPopuli i remember you tried something with glint ts program? Maybe that would work for this? |
well, to use type-are lints, you may not use @patricklx for the glint ts program thing, I don't recall if that was for linting or not |
@NullVoxPopuli in my reproduction, I am using But still there is the issue, unless I am missing something |
The issue is when gts is imported, not linted directly. But for typed linting the parser also needs to load the imported files. Internally that is done by typescript-eslint parser
|
Maybe we need a small ts plugin for this? Like for vue |
@patricklx, @NullVoxPopuli seems like the only reason why even direct linting of a But unfortunatelly this means it will only treat that one file like that, and for the rest it will read from disk, which means it will try to import Maybe asking |
Such feature might be beneficial not only to us, but seems like vue has same issue right now |
If we could tell it to use glint instead of tsc of 'the program', i think that could help, as it also has its own read file ... If it weren't for this
🙈 |
@NullVoxPopuli well if we pass it glints TS program, then it won't override anything it just uses the program as it's given |
Glint just maybe seems a bit overkill for this, if we could just override But it is just a theory, I can test it out tomorrow and if it works I can raise a feature request to |
Maybe we can use this? |
I tried a few things, but for now I just can't seem to get it to work :(, I'll keep trying next couple of days, but maybe someone else will have more luck with this |
I'm not really a pro at Eslint nor Typescript Compiler, but I did notice this strange behaviour
To me it seems that "type aware" linting isn't really fully working.
For example if we import something from a
gts
file, whatever we imported, the @typescript-eslint/parser won't be aware of it's typesHere is a link to a fork where I setup a test with reproduction:
vstefanovic97@70235ac
This is my theory on why this is happening (though I might be wrong):
Right now we rely on @typescript-eslint/parser to do everything and we just forward options to it, but if we just rely on it, it will generate a Typescript
Program
w/o including any of ourgts
files. It seems like we need to create our own typescriptProgram
with a customCompilerHost
that will know how to readgts
files.For context, terminology like
Program
andCompilerHost
are from https://github.com/microsoft/TypeScript/wiki/Using-the-Compiler-API, andtypescript-eslint
supports us providing it aprogram
in it's options so that seems like the way to go to me at leastThe text was updated successfully, but these errors were encountered: