-
Notifications
You must be signed in to change notification settings - Fork 63
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
Docs: Add TypeScript example #155
Conversation
6b72d5c
to
724c8c9
Compare
c96f269
to
ff6ffe1
Compare
724c8c9
to
636b706
Compare
636b706
to
890f7fd
Compare
890f7fd
to
6018276
Compare
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.
This generally looks good to me! Should we add a tsconfig.json
file in this example?
It works on the first block but not the second. See diff for additional context. Any ideas?
6018276
to
1c78364
Compare
@kaicataldo today I learned a bit about how type-aware linting works! Unfortunately I can't get it fully working. I can get the first |
@kaicataldo I tried a few more things and still wasn't able to get type-aware linting to work outside the first code block. Unless you have any ideas, what do you think of adding a note to this saying non-type-aware rules work with TS but type-aware rules don't for now? |
That works for me! I looked at it for a bit and wasn't able to figure it out either. Maybe @bradzacher has an idea? |
I don't believe type-aware linting will work. TL;DR - type-aware linting relies upon a file on disk, but preprocessors produce "fake" files. Long answer: For type-aware linting, we have to leverage TS's heavy compiler API, which works around having a ESLint preprocessors are a bit of a hack in that a preprocessor essentially splits one file into many "fake" files that don't exist on disk. Because there's no file on disk, the TS API can't find the file specified in its data structures, so we throw an error. |
Thank you @bradzacher, that's very helpful! Knowing that, I'm curious how type-aware rules worked at all in the first code block in 1c78364. Gremlins, apparently. In da4b9b0, I removed |
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.
LGTM!
#153 and #152 should be merged first.