-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
feat(typescript-estree): allow providing code as a ts.SourceFile #5892
feat(typescript-estree): allow providing code as a ts.SourceFile #5892
Conversation
Thanks for the PR, @JoshuaKGoldberg! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## v6 #5892 +/- ##
==========================================
+ Coverage 91.35% 91.68% +0.33%
==========================================
Files 364 356 -8
Lines 12132 12021 -111
Branches 3533 3523 -10
==========================================
- Hits 11083 11022 -61
+ Misses 750 701 -49
+ Partials 299 298 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
options?: ParserOptions, | ||
): ParseForESLintResult['ast'] { | ||
return parseForESLint(code, options).ast; | ||
} | ||
|
||
function parseForESLint( | ||
code: string, | ||
code: string | ts.SourceFile, |
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.
FYI @Quramy - is there anything else you'd need/want done to help with the use case described in #774?
cc @mhartington - you were showing me using Quramy's language service plugin. I'm betting this will speed it up ever so slightly (though I'd be surprised if file parsing was a major bottleneck). ✨
PR Checklist
Overview
Changes several function parameters from
code: string
tocode: string | ts.SourceFile
. Folks should now be able to pass in a source file directly, instead of the text of a file that we then have to redundantly reparse.Targeting the
v6
branch even though this arguably isn't really a breaking change. Since this is such a core API, I'd want it to be able to benefit from the v6 testing process too.