Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
feat(parser, typescript-estree): export withoutProjectParserOptions utility#9233
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
feat(parser, typescript-estree): export withoutProjectParserOptions utility#9233
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Thanks for the PR,@fpapado! 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 onhttps://opencollective.com/typescript-eslint. |
netlifybot commentedJun 3, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
✅ Deploy Preview fortypescript-eslint ready!
To edit notification comments on pull requests, go to yourNetlify site configuration. |
nx-cloudbot commentedJun 3, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
packages/typescript-estree/src/removeParserOptionsThatPromptTypechecking.ts OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
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.
packages/typescript-estree/src/removeParserOptionsThatPromptTypechecking.ts OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
packages/typescript-estree/src/removeParserOptionsThatPromptTypechecking.ts OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
packages/typescript-estree/src/removeParserOptionsThatPromptTypechecking.ts OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Thanks for the suggestions, they all make sense! Let me know if anything else comes up ✍️ |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
docs/packages/Parser.mdx Outdated
Removes options that prompt the parser to parse the project with type | ||
information. In other words, you can use this if you are invoking the parser | ||
directly, to ensure that one file will be parsed in isolation, which is much, | ||
much faster. | ||
This is useful in cases where you invoke the parser directly, such as in an | ||
ESLint plugin context. | ||
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.
Don't wrap lines by width. Either no breaks or wrap at sentence stops.
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 for catching this! Changed to sentence stops in15d47de
packages/typescript-estree/tests/lib/withoutProjectParserOptions.test.ts OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
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.
🚀
c9a6dd9
intotypescript-eslint:mainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
PR Checklist
Overview
Adds the utility described in#8428, allowing direct callers of the parser to omit options that would cause typechecking / type information to be collected. This essentially inverts the control back into
typescript-eslint
's codebase, and avoids having to sync changes across multiple third-party packages.The primary motivation is
eslint-plugin-import
, which uses the parser in isolation (hrough some eslint indirection), and sees a large speedup by not collecting type information.Rationale and Open Questions
I placed the utility in
typescript-estree
, so that it is co-located with the parser options themselves. The utility is re-exported by@typescript-eslint/parser
, since I imagine that a a conditionalrequire
(as described in#8428) would import the parser. It's a bit hard to design this without trying the call-site 😅The current implementation uses
TSESTreeOptions
. This means that we would need a separate PR for thev8
branch, which deletes only the things relevant to it. I think that's kinda nice, since we only ever touch keys that are relevant for the resolved parser. But, I might be missing something!(I added one other question in a PR comment)